@@ -17,7 +17,7 @@ declare module "gulp-typescript" {
17
17
stripInternal ?: boolean ;
18
18
types ?: string [ ] ;
19
19
}
20
- interface CompileStream extends NodeJS . ReadWriteStream { } // Either gulp or gulp-typescript has some odd typings which don't reflect reality, making this required
20
+ interface CompileStream extends NodeJS . ReadWriteStream { } // Either gulp or gulp-typescript has some odd typings which don't reflect reality, making this required
21
21
}
22
22
import * as insert from "gulp-insert" ;
23
23
import * as sourcemaps from "gulp-sourcemaps" ;
@@ -65,7 +65,7 @@ const cmdLineOptions = minimist(process.argv.slice(2), {
65
65
}
66
66
} ) ;
67
67
68
- function exec ( cmd : string , args : string [ ] , complete : ( ) => void = ( ( ) => { } ) , error : ( e : any , status : number ) => void = ( ( ) => { } ) ) {
68
+ function exec ( cmd : string , args : string [ ] , complete : ( ) => void = ( ( ) => { } ) , error : ( e : any , status : number ) => void = ( ( ) => { } ) ) {
69
69
console . log ( `${ cmd } ${ args . join ( " " ) } ` ) ;
70
70
// TODO (weswig): Update child_process types to add windowsVerbatimArguments to the type definition
71
71
const subshellFlag = isWin ? "/c" : "-c" ;
@@ -116,12 +116,12 @@ const es2015LibrarySources = [
116
116
] ;
117
117
118
118
const es2015LibrarySourceMap = es2015LibrarySources . map ( function ( source ) {
119
- return { target : "lib." + source , sources : [ "header.d.ts" , source ] } ;
119
+ return { target : "lib." + source , sources : [ "header.d.ts" , source ] } ;
120
120
} ) ;
121
121
122
- const es2016LibrarySource = [ "es2016.array.include.d.ts" ] ;
122
+ const es2016LibrarySource = [ "es2016.array.include.d.ts" ] ;
123
123
124
- const es2016LibrarySourceMap = es2016LibrarySource . map ( function ( source ) {
124
+ const es2016LibrarySourceMap = es2016LibrarySource . map ( function ( source ) {
125
125
return { target : "lib." + source , sources : [ "header.d.ts" , source ] } ;
126
126
} ) ;
127
127
@@ -130,38 +130,38 @@ const es2017LibrarySource = [
130
130
"es2017.sharedmemory.d.ts"
131
131
] ;
132
132
133
- const es2017LibrarySourceMap = es2017LibrarySource . map ( function ( source ) {
133
+ const es2017LibrarySourceMap = es2017LibrarySource . map ( function ( source ) {
134
134
return { target : "lib." + source , sources : [ "header.d.ts" , source ] } ;
135
135
} ) ;
136
136
137
137
const hostsLibrarySources = [ "dom.generated.d.ts" , "webworker.importscripts.d.ts" , "scripthost.d.ts" ] ;
138
138
139
139
const librarySourceMap = [
140
- // Host library
141
- { target : "lib.dom.d.ts" , sources : [ "header.d.ts" , "dom.generated.d.ts" ] } ,
142
- { target : "lib.dom.iterable.d.ts" , sources : [ "header.d.ts" , "dom.iterable.d.ts" ] } ,
143
- { target : "lib.webworker.d.ts" , sources : [ "header.d.ts" , "webworker.generated.d.ts" ] } ,
144
- { target : "lib.scripthost.d.ts" , sources : [ "header.d.ts" , "scripthost.d.ts" ] } ,
145
-
146
- // JavaScript library
147
- { target : "lib.es5.d.ts" , sources : [ "header.d.ts" , "es5.d.ts" ] } ,
148
- { target : "lib.es2015.d.ts" , sources : [ "header.d.ts" , "es2015.d.ts" ] } ,
149
- { target : "lib.es2016.d.ts" , sources : [ "header.d.ts" , "es2016.d.ts" ] } ,
150
- { target : "lib.es2017.d.ts" , sources : [ "header.d.ts" , "es2017.d.ts" ] } ,
151
-
152
- // JavaScript + all host library
153
- { target : "lib.d.ts" , sources : [ "header.d.ts" , "es5.d.ts" ] . concat ( hostsLibrarySources ) } ,
154
- { target : "lib.es6.d.ts" , sources : [ "header.d.ts" , "es5.d.ts" ] . concat ( es2015LibrarySources , hostsLibrarySources , "dom.iterable.d.ts" ) }
140
+ // Host library
141
+ { target : "lib.dom.d.ts" , sources : [ "header.d.ts" , "dom.generated.d.ts" ] } ,
142
+ { target : "lib.dom.iterable.d.ts" , sources : [ "header.d.ts" , "dom.iterable.d.ts" ] } ,
143
+ { target : "lib.webworker.d.ts" , sources : [ "header.d.ts" , "webworker.generated.d.ts" ] } ,
144
+ { target : "lib.scripthost.d.ts" , sources : [ "header.d.ts" , "scripthost.d.ts" ] } ,
145
+
146
+ // JavaScript library
147
+ { target : "lib.es5.d.ts" , sources : [ "header.d.ts" , "es5.d.ts" ] } ,
148
+ { target : "lib.es2015.d.ts" , sources : [ "header.d.ts" , "es2015.d.ts" ] } ,
149
+ { target : "lib.es2016.d.ts" , sources : [ "header.d.ts" , "es2016.d.ts" ] } ,
150
+ { target : "lib.es2017.d.ts" , sources : [ "header.d.ts" , "es2017.d.ts" ] } ,
151
+
152
+ // JavaScript + all host library
153
+ { target : "lib.d.ts" , sources : [ "header.d.ts" , "es5.d.ts" ] . concat ( hostsLibrarySources ) } ,
154
+ { target : "lib.es6.d.ts" , sources : [ "header.d.ts" , "es5.d.ts" ] . concat ( es2015LibrarySources , hostsLibrarySources , "dom.iterable.d.ts" ) }
155
155
] . concat ( es2015LibrarySourceMap , es2016LibrarySourceMap , es2017LibrarySourceMap ) ;
156
156
157
- const libraryTargets = librarySourceMap . map ( function ( f ) {
157
+ const libraryTargets = librarySourceMap . map ( function ( f ) {
158
158
return path . join ( builtLocalDirectory , f . target ) ;
159
159
} ) ;
160
160
161
161
for ( const i in libraryTargets ) {
162
162
const entry = librarySourceMap [ i ] ;
163
163
const target = libraryTargets [ i ] ;
164
- const sources = [ copyright ] . concat ( entry . sources . map ( function ( s ) {
164
+ const sources = [ copyright ] . concat ( entry . sources . map ( function ( s ) {
165
165
return path . join ( libraryDirectory , s ) ;
166
166
} ) ) ;
167
167
gulp . task ( target , false , [ ] , function ( ) {
@@ -391,7 +391,7 @@ gulp.task(servicesFile, false, ["lib", "generate-diagnostics"], () => {
391
391
. pipe ( sourcemaps . init ( ) )
392
392
. pipe ( tsc ( servicesProject ) ) ;
393
393
const completedJs = js . pipe ( prependCopyright ( ) )
394
- . pipe ( sourcemaps . write ( "." ) ) ;
394
+ . pipe ( sourcemaps . write ( "." ) ) ;
395
395
const completedDts = dts . pipe ( prependCopyright ( /*outputCopyright*/ true ) )
396
396
. pipe ( insert . transform ( ( contents , file ) => {
397
397
file . path = standaloneDefinitionsFile ;
@@ -434,17 +434,17 @@ const tsserverLibraryDefinitionFile = path.join(builtLocalDirectory, "tsserverli
434
434
435
435
gulp . task ( tsserverLibraryFile , false , [ servicesFile ] , ( done ) => {
436
436
const serverLibraryProject = tsc . createProject ( "src/server/tsconfig.library.json" , getCompilerSettings ( { } , /*useBuiltCompiler*/ true ) ) ;
437
- const { js, dts} : { js : NodeJS . ReadableStream , dts : NodeJS . ReadableStream } = serverLibraryProject . src ( )
437
+ const { js, dts} : { js : NodeJS . ReadableStream , dts : NodeJS . ReadableStream } = serverLibraryProject . src ( )
438
438
. pipe ( sourcemaps . init ( ) )
439
439
. pipe ( newer ( tsserverLibraryFile ) )
440
440
. pipe ( tsc ( serverLibraryProject ) ) ;
441
441
442
442
return merge2 ( [
443
443
js . pipe ( prependCopyright ( ) )
444
- . pipe ( sourcemaps . write ( "." ) )
445
- . pipe ( gulp . dest ( builtLocalDirectory ) ) ,
444
+ . pipe ( sourcemaps . write ( "." ) )
445
+ . pipe ( gulp . dest ( builtLocalDirectory ) ) ,
446
446
dts . pipe ( prependCopyright ( ) )
447
- . pipe ( gulp . dest ( builtLocalDirectory ) )
447
+ . pipe ( gulp . dest ( builtLocalDirectory ) )
448
448
] ) ;
449
449
} ) ;
450
450
@@ -476,7 +476,7 @@ gulp.task(specMd, false, [word2mdJs], (done) => {
476
476
const specMDFullPath = path . resolve ( specMd ) ;
477
477
const cmd = "cscript //nologo " + word2mdJs + " \"" + specWordFullPath + "\" " + "\"" + specMDFullPath + "\"" ;
478
478
console . log ( cmd ) ;
479
- cp . exec ( cmd , function ( ) {
479
+ cp . exec ( cmd , function ( ) {
480
480
done ( ) ;
481
481
} ) ;
482
482
} ) ;
@@ -492,12 +492,12 @@ gulp.task("dontUseDebugMode", false, [], (done) => { useDebugMode = false; done(
492
492
493
493
gulp . task ( "VerifyLKG" , false , [ ] , ( ) => {
494
494
const expectedFiles = [ builtLocalCompiler , servicesFile , serverFile , nodePackageFile , nodeDefinitionsFile , standaloneDefinitionsFile , tsserverLibraryFile , tsserverLibraryDefinitionFile ] . concat ( libraryTargets ) ;
495
- const missingFiles = expectedFiles . filter ( function ( f ) {
495
+ const missingFiles = expectedFiles . filter ( function ( f ) {
496
496
return ! fs . existsSync ( f ) ;
497
497
} ) ;
498
498
if ( missingFiles . length > 0 ) {
499
499
throw new Error ( "Cannot replace the LKG unless all built targets are present in directory " + builtLocalDirectory +
500
- ". The following files are missing:\n" + missingFiles . join ( "\n" ) ) ;
500
+ ". The following files are missing:\n" + missingFiles . join ( "\n" ) ) ;
501
501
}
502
502
// Copy all the targets into the LKG directory
503
503
return gulp . src ( expectedFiles ) . pipe ( gulp . dest ( LKGDirectory ) ) ;
@@ -627,7 +627,7 @@ function runConsoleTests(defaultReporter: string, runInParallel: boolean, done:
627
627
}
628
628
args . push ( run ) ;
629
629
setNodeEnvToDevelopment ( ) ;
630
- runTestsInParallel ( taskConfigsFolder , run , { testTimeout : testTimeout , noColors : colors === " --no-colors " } , function ( err ) {
630
+ runTestsInParallel ( taskConfigsFolder , run , { testTimeout : testTimeout , noColors : colors === " --no-colors " } , function ( err ) {
631
631
// last worker clean everything and runs linter in case if there were no errors
632
632
del ( taskConfigsFolder ) . then ( ( ) => {
633
633
if ( ! err ) {
@@ -679,7 +679,7 @@ gulp.task("runtests",
679
679
[ "build-rules" , "tests" ] ,
680
680
( done ) => {
681
681
runConsoleTests ( "mocha-fivemat-progress-reporter" , /*runInParallel*/ false , done ) ;
682
- } ) ;
682
+ } ) ;
683
683
684
684
const nodeServerOutFile = "tests/webTestServer.js" ;
685
685
const nodeServerInFile = "tests/webTestServer.ts" ;
@@ -812,31 +812,38 @@ gulp.task("diff-rwc", "Diffs the RWC baselines using the diff tool specified by
812
812
} ) ;
813
813
814
814
815
- gulp . task ( "baseline-accept" , "Makes the most recent test results the new baseline, overwriting the old baseline" , ( done ) => {
816
- const softAccept = cmdLineOptions [ "soft" ] ;
817
- if ( ! softAccept ) {
818
- del ( refBaseline ) . then ( ( ) => {
819
- fs . renameSync ( localBaseline , refBaseline ) ;
820
- done ( ) ;
821
- } , done ) ;
822
- }
823
- else {
824
- gulp . src ( localBaseline )
825
- . pipe ( gulp . dest ( refBaseline ) )
826
- . on ( "end" , ( ) => {
827
- del ( path . join ( refBaseline , "local" ) ) . then ( ( ) => done ( ) , done ) ;
828
- } ) ;
829
- }
815
+ const deleteEnding = '.delete' ;
816
+ gulp . task ( "baseline-accept" , "Makes the most recent test results the new baseline, overwriting the old baseline" , ( ) => {
817
+ return baselineAccept ( "" ) ;
830
818
} ) ;
819
+
820
+ function baselineAccept ( subfolder = "" ) {
821
+ return merge2 ( baselineCopy ( subfolder ) , baselineDelete ( subfolder ) ) ;
822
+ }
823
+
824
+ function baselineCopy ( subfolder = "" ) {
825
+ return gulp . src ( [ `tests/baselines/local/${ subfolder } /**` , `!tests/baselines/local/${ subfolder } /**/*.delete` ] )
826
+ . pipe ( gulp . dest ( refBaseline ) ) ;
827
+ }
828
+
829
+ function baselineDelete ( subfolder = "" ) {
830
+ return gulp . src ( [ 'tests/baselines/local/**/*.delete' ] )
831
+ . pipe ( insert . transform ( ( content , fileObj ) => {
832
+ const target = path . join ( refBaseline , fileObj . relative . substr ( 0 , fileObj . relative . length - '.delete' . length ) ) ;
833
+ console . log ( target ) ;
834
+ del . sync ( target ) ;
835
+ del . sync ( fileObj . path ) ;
836
+ return '' ;
837
+ } ) ) ;
838
+ }
839
+
831
840
gulp . task ( "baseline-accept-rwc" , "Makes the most recent rwc test results the new baseline, overwriting the old baseline" , ( ) => {
832
- return del ( refRwcBaseline ) . then ( ( ) => {
833
- fs . renameSync ( localRwcBaseline , refRwcBaseline ) ;
834
- } ) ;
841
+ return baselineAccept ( "rwc" ) ;
835
842
} ) ;
843
+
844
+
836
845
gulp . task ( "baseline-accept-test262" , "Makes the most recent test262 test results the new baseline, overwriting the old baseline" , ( ) => {
837
- return del ( refTest262Baseline ) . then ( ( ) => {
838
- fs . renameSync ( localTest262Baseline , refTest262Baseline ) ;
839
- } ) ;
846
+ return baselineAccept ( "test262" ) ;
840
847
} ) ;
841
848
842
849
0 commit comments