@@ -46,14 +46,15 @@ const cmdLineOptions = minimist(process.argv.slice(2), {
46
46
boolean : [ "debug" , "inspect" , "light" , "colors" , "lint" , "soft" ] ,
47
47
string : [ "browser" , "tests" , "host" , "reporter" , "stackTraceLimit" , "timeout" ] ,
48
48
alias : {
49
- b : "browser" ,
50
- d : "debug" , "debug-brk" : "debug" ,
51
- i : "inspect" , "inspect-brk" : "inspect" ,
52
- t : "tests" , test : "tests" ,
53
- r : "reporter" ,
54
- c : "colors" , color : "colors" ,
55
- f : "files" , file : "files" ,
56
- w : "workers" ,
49
+ "b" : "browser" ,
50
+ "d" : "debug" , "debug-brk" : "debug" ,
51
+ "i" : "inspect" , "inspect-brk" : "inspect" ,
52
+ "t" : "tests" , "test" : "tests" ,
53
+ "ru" : "runners" , "runner" : "runners" ,
54
+ "r" : "reporter" ,
55
+ "c" : "colors" , "color" : "colors" ,
56
+ "f" : "files" , "file" : "files" ,
57
+ "w" : "workers" ,
57
58
} ,
58
59
default : {
59
60
soft : false ,
@@ -64,6 +65,7 @@ const cmdLineOptions = minimist(process.argv.slice(2), {
64
65
browser : process . env . browser || process . env . b || "IE" ,
65
66
timeout : process . env . timeout || 40000 ,
66
67
tests : process . env . test || process . env . tests || process . env . t ,
68
+ runners : process . env . runners || process . env . runner || process . env . ru ,
67
69
light : process . env . light === undefined || process . env . light !== "false" ,
68
70
reporter : process . env . reporter || process . env . r ,
69
71
lint : process . env . lint || true ,
@@ -72,7 +74,8 @@ const cmdLineOptions = minimist(process.argv.slice(2), {
72
74
}
73
75
} ) ;
74
76
75
- function exec ( cmd : string , args : string [ ] , complete : ( ) => void = ( ( ) => { } ) , error : ( e : any , status : number ) => void = ( ( ) => { } ) ) {
77
+ const noop = ( ) => { } ; // tslint:disable-line no-empty
78
+ function exec ( cmd : string , args : string [ ] , complete : ( ) => void = noop , error : ( e : any , status : number ) => void = noop ) {
76
79
console . log ( `${ cmd } ${ args . join ( " " ) } ` ) ;
77
80
// TODO (weswig): Update child_process types to add windowsVerbatimArguments to the type definition
78
81
const subshellFlag = isWin ? "/c" : "-c" ;
@@ -99,12 +102,12 @@ const lclDirectory = "src/loc/lcl";
99
102
100
103
const builtDirectory = "built/" ;
101
104
const builtLocalDirectory = "built/local/" ;
102
- const LKGDirectory = "lib/" ;
105
+ const lkgDirectory = "lib/" ;
103
106
104
107
const copyright = "CopyrightNotice.txt" ;
105
108
106
109
const compilerFilename = "tsc.js" ;
107
- const LKGCompiler = path . join ( LKGDirectory , compilerFilename ) ;
110
+ const lkgCompiler = path . join ( lkgDirectory , compilerFilename ) ;
108
111
const builtLocalCompiler = path . join ( builtLocalDirectory , compilerFilename ) ;
109
112
110
113
const nodeModulesPathPrefix = path . resolve ( "./node_modules/.bin/" ) ;
@@ -123,34 +126,35 @@ const es2015LibrarySources = [
123
126
"es2015.symbol.wellknown.d.ts"
124
127
] ;
125
128
126
- const es2015LibrarySourceMap = es2015LibrarySources . map ( function ( source ) {
127
- return { target : "lib." + source , sources : [ "header.d.ts" , source ] } ;
128
- } ) ;
129
+ const es2015LibrarySourceMap = es2015LibrarySources . map ( source =>
130
+ ( { target : "lib." + source , sources : [ "header.d.ts" , source ] } ) ) ;
129
131
130
132
const es2016LibrarySource = [ "es2016.array.include.d.ts" ] ;
131
133
132
- const es2016LibrarySourceMap = es2016LibrarySource . map ( function ( source ) {
133
- return { target : "lib." + source , sources : [ "header.d.ts" , source ] } ;
134
- } ) ;
134
+ const es2016LibrarySourceMap = es2016LibrarySource . map ( source =>
135
+ ( { target : "lib." + source , sources : [ "header.d.ts" , source ] } ) ) ;
135
136
136
137
const es2017LibrarySource = [
137
138
"es2017.object.d.ts" ,
138
139
"es2017.sharedmemory.d.ts" ,
139
140
"es2017.string.d.ts" ,
140
141
"es2017.intl.d.ts" ,
142
+ "es2017.typedarrays.d.ts" ,
141
143
] ;
142
144
143
- const es2017LibrarySourceMap = es2017LibrarySource . map ( function ( source ) {
144
- return { target : "lib." + source , sources : [ "header.d.ts" , source ] } ;
145
- } ) ;
145
+ const es2017LibrarySourceMap = es2017LibrarySource . map ( source =>
146
+ ( { target : "lib." + source , sources : [ "header.d.ts" , source ] } ) ) ;
147
+
148
+ const es2018LibrarySource = [ ] ;
149
+ const es2018LibrarySourceMap = es2018LibrarySource . map ( source =>
150
+ ( { target : "lib." + source , sources : [ "header.d.ts" , source ] } ) ) ;
146
151
147
152
const esnextLibrarySource = [
148
153
"esnext.asynciterable.d.ts"
149
154
] ;
150
155
151
- const esnextLibrarySourceMap = esnextLibrarySource . map ( function ( source ) {
152
- return { target : "lib." + source , sources : [ "header.d.ts" , source ] } ;
153
- } ) ;
156
+ const esnextLibrarySourceMap = esnextLibrarySource . map ( source =>
157
+ ( { target : "lib." + source , sources : [ "header.d.ts" , source ] } ) ) ;
154
158
155
159
const hostsLibrarySources = [ "dom.generated.d.ts" , "webworker.importscripts.d.ts" , "scripthost.d.ts" ] ;
156
160
@@ -166,19 +170,20 @@ const librarySourceMap = [
166
170
{ target : "lib.es2015.d.ts" , sources : [ "header.d.ts" , "es2015.d.ts" ] } ,
167
171
{ target : "lib.es2016.d.ts" , sources : [ "header.d.ts" , "es2016.d.ts" ] } ,
168
172
{ target : "lib.es2017.d.ts" , sources : [ "header.d.ts" , "es2017.d.ts" ] } ,
173
+ { target : "lib.es2018.d.ts" , sources : [ "header.d.ts" , "es2018.d.ts" ] } ,
169
174
{ target : "lib.esnext.d.ts" , sources : [ "header.d.ts" , "esnext.d.ts" ] } ,
170
175
171
176
// JavaScript + all host library
172
177
{ target : "lib.d.ts" , sources : [ "header.d.ts" , "es5.d.ts" ] . concat ( hostsLibrarySources ) } ,
173
178
{ target : "lib.es6.d.ts" , sources : [ "header.d.ts" , "es5.d.ts" ] . concat ( es2015LibrarySources , hostsLibrarySources , "dom.iterable.d.ts" ) } ,
174
179
{ target : "lib.es2016.full.d.ts" , sources : [ "header.d.ts" , "es2016.d.ts" ] . concat ( hostsLibrarySources , "dom.iterable.d.ts" ) } ,
175
180
{ target : "lib.es2017.full.d.ts" , sources : [ "header.d.ts" , "es2017.d.ts" ] . concat ( hostsLibrarySources , "dom.iterable.d.ts" ) } ,
181
+ { target : "lib.es2018.full.d.ts" , sources : [ "header.d.ts" , "es2018.d.ts" ] . concat ( hostsLibrarySources , "dom.iterable.d.ts" ) } ,
176
182
{ target : "lib.esnext.full.d.ts" , sources : [ "header.d.ts" , "esnext.d.ts" ] . concat ( hostsLibrarySources , "dom.iterable.d.ts" ) } ,
177
- ] . concat ( es2015LibrarySourceMap , es2016LibrarySourceMap , es2017LibrarySourceMap , esnextLibrarySourceMap ) ;
183
+ ] . concat ( es2015LibrarySourceMap , es2016LibrarySourceMap , es2017LibrarySourceMap , es2018LibrarySourceMap , esnextLibrarySourceMap ) ;
178
184
179
- const libraryTargets = librarySourceMap . map ( function ( f ) {
180
- return path . join ( builtLocalDirectory , f . target ) ;
181
- } ) ;
185
+ const libraryTargets = librarySourceMap . map ( f =>
186
+ path . join ( builtLocalDirectory , f . target ) ) ;
182
187
183
188
/**
184
189
* .lcg file is what localization team uses to know what messages to localize.
@@ -193,22 +198,19 @@ const generatedLCGFile = path.join(builtLocalDirectory, "enu", "diagnosticMessag
193
198
* 2. 'src\compiler\diagnosticMessages.generated.json' => 'built\local\ENU\diagnosticMessages.generated.json.lcg'
194
199
* generate the lcg file (source of messages to localize) from the diagnosticMessages.generated.json
195
200
*/
196
- const localizationTargets = [ "cs" , "de" , "es" , "fr" , "it" , "ja" , "ko" , "pl" , "pt-BR" , "ru" , "tr" , "zh-CN" , "zh-TW" ] . map ( function ( f ) {
197
- return path . join ( builtLocalDirectory , f , "diagnosticMessages.generated.json" ) ;
198
- } ) . concat ( generatedLCGFile ) ;
201
+ const localizationTargets = [ "cs" , "de" , "es" , "fr" , "it" , "ja" , "ko" , "pl" , "pt-BR" , "ru" , "tr" , "zh-CN" , "zh-TW" ]
202
+ . map ( f => path . join ( builtLocalDirectory , f , "diagnosticMessages.generated.json" ) )
203
+ . concat ( generatedLCGFile ) ;
199
204
200
205
for ( const i in libraryTargets ) {
201
206
const entry = librarySourceMap [ i ] ;
202
207
const target = libraryTargets [ i ] ;
203
- const sources = [ copyright ] . concat ( entry . sources . map ( function ( s ) {
204
- return path . join ( libraryDirectory , s ) ;
205
- } ) ) ;
206
- gulp . task ( target , /*help*/ false , [ ] , function ( ) {
207
- return gulp . src ( sources )
208
+ const sources = [ copyright ] . concat ( entry . sources . map ( s => path . join ( libraryDirectory , s ) ) ) ;
209
+ gulp . task ( target , /*help*/ false , [ ] , ( ) =>
210
+ gulp . src ( sources )
208
211
. pipe ( newer ( target ) )
209
212
. pipe ( concat ( target , { newLine : "\n\n" } ) )
210
- . pipe ( gulp . dest ( "." ) ) ;
211
- } ) ;
213
+ . pipe ( gulp . dest ( "." ) ) ) ;
212
214
}
213
215
214
216
const configureNightlyJs = path . join ( scriptsDirectory , "configureNightly.js" ) ;
@@ -575,9 +577,7 @@ gulp.task(specMd, /*help*/ false, [word2mdJs], (done) => {
575
577
const specMDFullPath = path . resolve ( specMd ) ;
576
578
const cmd = "cscript //nologo " + word2mdJs + " \"" + specWordFullPath + "\" " + "\"" + specMDFullPath + "\"" ;
577
579
console . log ( cmd ) ;
578
- cp . exec ( cmd , function ( ) {
579
- done ( ) ;
580
- } ) ;
580
+ cp . exec ( cmd , done ) ;
581
581
} ) ;
582
582
583
583
gulp . task ( "generate-spec" , "Generates a Markdown version of the Language Specification" , [ specMd ] ) ;
@@ -599,7 +599,7 @@ gulp.task("VerifyLKG", /*help*/ false, [], () => {
599
599
". The following files are missing:\n" + missingFiles . join ( "\n" ) ) ;
600
600
}
601
601
// Copy all the targets into the LKG directory
602
- return gulp . src ( [ ...expectedFiles , path . join ( builtLocalDirectory , "**" ) , `!${ path . join ( builtLocalDirectory , "tslint" ) } ` , `!${ path . join ( builtLocalDirectory , "*.*" ) } ` ] ) . pipe ( gulp . dest ( LKGDirectory ) ) ;
602
+ return gulp . src ( [ ...expectedFiles , path . join ( builtLocalDirectory , "**" ) , `!${ path . join ( builtLocalDirectory , "tslint" ) } ` , `!${ path . join ( builtLocalDirectory , "*.*" ) } ` ] ) . pipe ( gulp . dest ( lkgDirectory ) ) ;
603
603
} ) ;
604
604
605
605
gulp . task ( "LKGInternal" , /*help*/ false , [ "lib" , "local" ] ) ;
@@ -658,6 +658,7 @@ function runConsoleTests(defaultReporter: string, runInParallel: boolean, done:
658
658
const debug = cmdLineOptions . debug ;
659
659
const inspect = cmdLineOptions . inspect ;
660
660
const tests = cmdLineOptions . tests ;
661
+ const runners = cmdLineOptions . runners ;
661
662
const light = cmdLineOptions . light ;
662
663
const stackTraceLimit = cmdLineOptions . stackTraceLimit ;
663
664
const testConfigFile = "test.config" ;
@@ -678,8 +679,8 @@ function runConsoleTests(defaultReporter: string, runInParallel: boolean, done:
678
679
workerCount = cmdLineOptions . workers ;
679
680
}
680
681
681
- if ( tests || light || taskConfigsFolder ) {
682
- writeTestConfigFile ( tests , light , taskConfigsFolder , workerCount , stackTraceLimit ) ;
682
+ if ( tests || runners || light || taskConfigsFolder ) {
683
+ writeTestConfigFile ( tests , runners , light , taskConfigsFolder , workerCount , stackTraceLimit ) ;
683
684
}
684
685
685
686
if ( tests && tests . toLocaleLowerCase ( ) === "rwc" ) {
@@ -714,17 +715,13 @@ function runConsoleTests(defaultReporter: string, runInParallel: boolean, done:
714
715
}
715
716
args . push ( run ) ;
716
717
setNodeEnvToDevelopment ( ) ;
717
- exec ( mocha , args , lintThenFinish , function ( e , status ) {
718
- finish ( e , status ) ;
719
- } ) ;
718
+ exec ( mocha , args , lintThenFinish , finish ) ;
720
719
721
720
}
722
721
else {
723
722
// run task to load all tests and partition them between workers
724
723
setNodeEnvToDevelopment ( ) ;
725
- exec ( host , [ run ] , lintThenFinish , function ( e , status ) {
726
- finish ( e , status ) ;
727
- } ) ;
724
+ exec ( host , [ run ] , lintThenFinish , finish ) ;
728
725
}
729
726
} ) ;
730
727
@@ -874,8 +871,8 @@ function cleanTestDirs(done: (e?: any) => void) {
874
871
}
875
872
876
873
// used to pass data from jake command line directly to run.js
877
- function writeTestConfigFile ( tests : string , light : boolean , taskConfigsFolder ?: string , workerCount ?: number , stackTraceLimit ?: string ) {
878
- const testConfigContents = JSON . stringify ( { test : tests ? [ tests ] : undefined , light, workerCount, stackTraceLimit, taskConfigsFolder, noColor : ! cmdLineOptions . colors } ) ;
874
+ function writeTestConfigFile ( tests : string , runners : string , light : boolean , taskConfigsFolder ?: string , workerCount ?: number , stackTraceLimit ?: string ) {
875
+ const testConfigContents = JSON . stringify ( { test : tests ? [ tests ] : undefined , runner : runners ? runners . split ( "," ) : undefined , light, workerCount, stackTraceLimit, taskConfigsFolder, noColor : ! cmdLineOptions . colors } ) ;
879
876
console . log ( "Running tests with config: " + testConfigContents ) ;
880
877
fs . writeFileSync ( "test.config" , testConfigContents ) ;
881
878
}
@@ -886,13 +883,14 @@ gulp.task("runtests-browser", "Runs the tests using the built run.js file like '
886
883
if ( err ) { console . error ( err ) ; done ( err ) ; process . exit ( 1 ) ; }
887
884
host = "node" ;
888
885
const tests = cmdLineOptions . tests ;
886
+ const runners = cmdLineOptions . runners ;
889
887
const light = cmdLineOptions . light ;
890
888
const testConfigFile = "test.config" ;
891
889
if ( fs . existsSync ( testConfigFile ) ) {
892
890
fs . unlinkSync ( testConfigFile ) ;
893
891
}
894
- if ( tests || light ) {
895
- writeTestConfigFile ( tests , light ) ;
892
+ if ( tests || runners || light ) {
893
+ writeTestConfigFile ( tests , runners , light ) ;
896
894
}
897
895
898
896
const args = [ nodeServerOutFile ] ;
@@ -1006,7 +1004,7 @@ gulp.task(loggedIOJsPath, /*help*/ false, [], (done) => {
1006
1004
const temp = path . join ( builtLocalDirectory , "temp" ) ;
1007
1005
mkdirP ( temp , ( err ) => {
1008
1006
if ( err ) { console . error ( err ) ; done ( err ) ; process . exit ( 1 ) ; }
1009
- exec ( host , [ LKGCompiler , "--types" , "--target es5" , "--lib es5" , "--outdir" , temp , loggedIOpath ] , ( ) => {
1007
+ exec ( host , [ lkgCompiler , "--types" , "--target es5" , "--lib es5" , "--outdir" , temp , loggedIOpath ] , ( ) => {
1010
1008
fs . renameSync ( path . join ( temp , "/harness/loggedIO.js" ) , loggedIOJsPath ) ;
1011
1009
del ( temp ) . then ( ( ) => done ( ) , done ) ;
1012
1010
} , done ) ;
@@ -1043,7 +1041,7 @@ gulp.task("update-sublime", "Updates the sublime plugin's tsserver", ["local", s
1043
1041
} ) ;
1044
1042
1045
1043
gulp . task ( "build-rules" , "Compiles tslint rules to js" , ( ) => {
1046
- const settings : tsc . Settings = getCompilerSettings ( { module : "commonjs" , " lib" : [ "es6" ] } , /*useBuiltCompiler*/ false ) ;
1044
+ const settings : tsc . Settings = getCompilerSettings ( { module : "commonjs" , lib : [ "es6" ] } , /*useBuiltCompiler*/ false ) ;
1047
1045
const dest = path . join ( builtLocalDirectory , "tslint" ) ;
1048
1046
return gulp . src ( "scripts/tslint/**/*.ts" )
1049
1047
. pipe ( newer ( {
@@ -1082,7 +1080,7 @@ function sendNextFile(files: {path: string}[], child: cp.ChildProcess, callback:
1082
1080
function spawnLintWorker ( files : { path : string } [ ] , callback : ( failures : number ) => void ) {
1083
1081
const child = cp . fork ( "./scripts/parallel-lint" ) ;
1084
1082
let failures = 0 ;
1085
- child . on ( "message" , function ( data ) {
1083
+ child . on ( "message" , data => {
1086
1084
switch ( data . kind ) {
1087
1085
case "result" :
1088
1086
if ( data . failures > 0 ) {
@@ -1106,7 +1104,7 @@ gulp.task("lint", "Runs tslint on the compiler sources. Optional arguments are:
1106
1104
const fileMatcher = cmdLineOptions . files ;
1107
1105
const files = fileMatcher
1108
1106
? `src/**/${ fileMatcher } `
1109
- : "Gulpfile.ts 'scripts/generateLocalizedDiagnosticMessages.ts' 'scripts/tslint/**/*.ts' 'src/**/*.ts' --exclude src/lib/es5.d.ts --exclude 'src/lib/*.generated .d.ts'" ;
1107
+ : "Gulpfile.ts 'scripts/generateLocalizedDiagnosticMessages.ts' 'scripts/tslint/**/*.ts' 'src/**/*.ts' --exclude 'src/lib/*.d.ts'" ;
1110
1108
const cmd = `node node_modules/tslint/bin/tslint ${ files } --formatters-dir ./built/local/tslint/formatters --format autolinkableStylish` ;
1111
1109
console . log ( "Linting: " + cmd ) ;
1112
1110
child_process . execSync ( cmd , { stdio : [ 0 , 1 , 2 ] } ) ;
0 commit comments