@@ -160,7 +160,7 @@ var harnessSources = harnessCoreSources.concat([
160
160
"protocol.d.ts" ,
161
161
"session.ts" ,
162
162
"client.ts" ,
163
- "editorServices.ts" ,
163
+ "editorServices.ts"
164
164
] . map ( function ( f ) {
165
165
return path . join ( serverDirectory , f ) ;
166
166
} ) ) ;
@@ -174,7 +174,7 @@ var es2015LibrarySources = [
174
174
"es2015.proxy.d.ts" ,
175
175
"es2015.reflect.d.ts" ,
176
176
"es2015.symbol.d.ts" ,
177
- "es2015.symbol.wellknown.d.ts" ,
177
+ "es2015.symbol.wellknown.d.ts"
178
178
] ;
179
179
180
180
var es2015LibrarySourceMap = es2015LibrarySources . map ( function ( source ) {
@@ -183,28 +183,35 @@ var es2015LibrarySourceMap = es2015LibrarySources.map(function(source) {
183
183
184
184
var es2016LibrarySource = [ "es2016.array.include.d.ts" ] ;
185
185
186
- var es2016LibrarySourceMap = es2016LibrarySource . map ( function ( source ) {
186
+ var es2016LibrarySourceMap = es2016LibrarySource . map ( function ( source ) {
187
+ return { target : "lib." + source , sources : [ "header.d.ts" , source ] } ;
188
+ } ) ;
189
+
190
+ var es2017LibrarySource = [ "es2017.object.d.ts" ] ;
191
+
192
+ var es2017LibrarySourceMap = es2017LibrarySource . map ( function ( source ) {
187
193
return { target : "lib." + source , sources : [ "header.d.ts" , source ] } ;
188
- } )
194
+ } ) ;
189
195
190
- var hostsLibrarySources = [ "dom.generated.d.ts" , "webworker.importscripts.d.ts" , "scripthost.d.ts" ]
196
+ var hostsLibrarySources = [ "dom.generated.d.ts" , "webworker.importscripts.d.ts" , "scripthost.d.ts" ] ;
191
197
192
198
var librarySourceMap = [
193
199
// Host library
194
- { target : "lib.dom.d.ts" , sources : [ "header.d.ts" , "dom.generated.d.ts" ] , } ,
195
- { target : "lib.dom.iterable.d.ts" , sources : [ "header.d.ts" , "dom.iterable.d.ts" ] , } ,
196
- { target : "lib.webworker.d.ts" , sources : [ "header.d.ts" , "webworker.generated.d.ts" ] , } ,
197
- { target : "lib.scripthost.d.ts" , sources : [ "header.d.ts" , "scripthost.d.ts" ] , } ,
198
-
200
+ { target : "lib.dom.d.ts" , sources : [ "header.d.ts" , "dom.generated.d.ts" ] } ,
201
+ { target : "lib.dom.iterable.d.ts" , sources : [ "header.d.ts" , "dom.iterable.d.ts" ] } ,
202
+ { target : "lib.webworker.d.ts" , sources : [ "header.d.ts" , "webworker.generated.d.ts" ] } ,
203
+ { target : "lib.scripthost.d.ts" , sources : [ "header.d.ts" , "scripthost.d.ts" ] } ,
204
+
199
205
// JavaScript library
200
206
{ target : "lib.es5.d.ts" , sources : [ "header.d.ts" , "es5.d.ts" ] } ,
201
207
{ target : "lib.es2015.d.ts" , sources : [ "header.d.ts" , "es2015.d.ts" ] } ,
202
208
{ target : "lib.es2016.d.ts" , sources : [ "header.d.ts" , "es2016.d.ts" ] } ,
209
+ { target : "lib.es2017.d.ts" , sources : [ "header.d.ts" , "es2017.d.ts" ] } ,
203
210
204
211
// JavaScript + all host library
205
- { target : "lib.d.ts" , sources : [ "header.d.ts" , "es5.d.ts" ] . concat ( hostsLibrarySources ) , } ,
206
- { target : "lib.es6.d.ts" , sources : [ "header.d.ts" , "es5.d.ts" ] . concat ( es2015LibrarySources , hostsLibrarySources , "dom.iterable.d.ts" ) , } ,
207
- ] . concat ( es2015LibrarySourceMap , es2016LibrarySourceMap ) ;
212
+ { target : "lib.d.ts" , sources : [ "header.d.ts" , "es5.d.ts" ] . concat ( hostsLibrarySources ) } ,
213
+ { target : "lib.es6.d.ts" , sources : [ "header.d.ts" , "es5.d.ts" ] . concat ( es2015LibrarySources , hostsLibrarySources , "dom.iterable.d.ts" ) }
214
+ ] . concat ( es2015LibrarySourceMap , es2016LibrarySourceMap , es2017LibrarySourceMap ) ;
208
215
209
216
var libraryTargets = librarySourceMap . map ( function ( f ) {
210
217
return path . join ( builtLocalDirectory , f . target ) ;
@@ -244,7 +251,7 @@ function concatenateFiles(destinationFile, sourceFiles) {
244
251
}
245
252
246
253
var useDebugMode = true ;
247
- var host = ( process . env . TYPESCRIPT_HOST || process . env . host || "node" ) ;
254
+ var host = process . env . TYPESCRIPT_HOST || process . env . host || "node" ;
248
255
var compilerFilename = "tsc.js" ;
249
256
var LKGCompiler = path . join ( LKGDirectory , compilerFilename ) ;
250
257
var builtLocalCompiler = path . join ( builtLocalDirectory , compilerFilename ) ;
@@ -293,7 +300,7 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, opts
293
300
options += " --out " + outFile ;
294
301
}
295
302
else {
296
- options += " --module commonjs"
303
+ options += " --module commonjs" ;
297
304
}
298
305
299
306
if ( opts . noResolve ) {
@@ -308,7 +315,7 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, opts
308
315
}
309
316
310
317
if ( opts . stripInternal ) {
311
- options += " --stripInternal"
318
+ options += " --stripInternal" ;
312
319
}
313
320
314
321
var cmd = host + " " + compilerPath + " " + options + " " ;
@@ -446,9 +453,9 @@ file(scriptsTsdJson);
446
453
447
454
task ( "tsd-scripts" , [ scriptsTsdJson ] , function ( ) {
448
455
var cmd = "tsd --config " + scriptsTsdJson + " install" ;
449
- console . log ( cmd )
456
+ console . log ( cmd ) ;
450
457
exec ( cmd ) ;
451
- } , { async : true } )
458
+ } , { async : true } ) ;
452
459
453
460
var importDefinitelyTypedTestsDirectory = path . join ( scriptsDirectory , "importDefinitelyTypedTests" ) ;
454
461
var importDefinitelyTypedTestsJs = path . join ( importDefinitelyTypedTestsDirectory , "importDefinitelyTypedTests.js" ) ;
@@ -518,9 +525,10 @@ compileFile(servicesFileInBrowserTest, servicesSources,[builtLocalDirectory, cop
518
525
var serverFile = path . join ( builtLocalDirectory , "tsserver.js" ) ;
519
526
compileFile ( serverFile , serverSources , [ builtLocalDirectory , copyright ] . concat ( serverSources ) , /*prefixes*/ [ copyright ] , /*useBuiltCompiler*/ true ) ;
520
527
521
- var lsslFile = path . join ( builtLocalDirectory , "tslssl.js" ) ;
528
+ var tsserverLibraryFile = path . join ( builtLocalDirectory , "tsserverlibrary.js" ) ;
529
+ var tsserverLibraryDefinitionFile = path . join ( builtLocalDirectory , "tsserverlibrary.d.ts" ) ;
522
530
compileFile (
523
- lsslFile ,
531
+ tsserverLibraryFile ,
524
532
languageServiceLibrarySources ,
525
533
[ builtLocalDirectory , copyright ] . concat ( languageServiceLibrarySources ) ,
526
534
/*prefixes*/ [ copyright ] ,
@@ -529,7 +537,7 @@ compileFile(
529
537
530
538
// Local target to build the language service server library
531
539
desc ( "Builds language service server library" ) ;
532
- task ( "lssl" , [ lsslFile ] ) ;
540
+ task ( "lssl" , [ tsserverLibraryFile , tsserverLibraryDefinitionFile ] ) ;
533
541
534
542
// Local target to build the compiler and services
535
543
desc ( "Builds the full compiler and services" ) ;
@@ -588,8 +596,8 @@ task("generate-spec", [specMd]);
588
596
589
597
// Makes a new LKG. This target does not build anything, but errors if not all the outputs are present in the built/local directory
590
598
desc ( "Makes a new LKG out of the built js files" ) ;
591
- task ( "LKG" , [ "clean" , "release" , "local" ] . concat ( libraryTargets ) , function ( ) {
592
- var expectedFiles = [ tscFile , servicesFile , serverFile , nodePackageFile , nodeDefinitionsFile , standaloneDefinitionsFile ] . concat ( libraryTargets ) ;
599
+ task ( "LKG" , [ "clean" , "release" , "local" , "lssl" ] . concat ( libraryTargets ) , function ( ) {
600
+ var expectedFiles = [ tscFile , servicesFile , serverFile , nodePackageFile , nodeDefinitionsFile , standaloneDefinitionsFile , tsserverLibraryFile , tsserverLibraryDefinitionFile ] . concat ( libraryTargets ) ;
593
601
var missingFiles = expectedFiles . filter ( function ( f ) {
594
602
return ! fs . existsSync ( f ) ;
595
603
} ) ;
@@ -615,7 +623,7 @@ directory(builtLocalDirectory);
615
623
var run = path . join ( builtLocalDirectory , "run.js" ) ;
616
624
compileFile ( run , harnessSources , [ builtLocalDirectory , tscFile ] . concat ( libraryTargets ) . concat ( harnessSources ) , [ ] , /*useBuiltCompiler:*/ true ) ;
617
625
618
- var internalTests = "internal/"
626
+ var internalTests = "internal/" ;
619
627
620
628
var localBaseline = "tests/baselines/local/" ;
621
629
var refBaseline = "tests/baselines/reference/" ;
@@ -702,15 +710,16 @@ function runConsoleTests(defaultReporter, defaultSubsets) {
702
710
testTimeout = 100000 ;
703
711
}
704
712
705
- colors = process . env . colors || process . env . color
713
+ colors = process . env . colors || process . env . color ;
706
714
colors = colors ? ' --no-colors ' : ' --colors ' ;
707
715
reporter = process . env . reporter || process . env . r || defaultReporter ;
716
+ var lintFlag = process . env . lint !== 'false' ;
708
717
709
718
// timeout normally isn't necessary but Travis-CI has been timing out on compiler baselines occasionally
710
719
// default timeout is 2sec which really should be enough, but maybe we just need a small amount longer
711
720
var subsetRegexes ;
712
721
if ( defaultSubsets . length === 0 ) {
713
- subsetRegexes = [ tests ]
722
+ subsetRegexes = [ tests ] ;
714
723
}
715
724
else {
716
725
var subsets = tests ? tests . split ( "|" ) : defaultSubsets ;
@@ -721,19 +730,20 @@ function runConsoleTests(defaultReporter, defaultSubsets) {
721
730
tests = subsetRegex ? ' -g "' + subsetRegex + '"' : '' ;
722
731
var cmd = "mocha" + ( debug ? " --debug-brk" : "" ) + " -R " + reporter + tests + colors + ' -t ' + testTimeout + ' ' + run ;
723
732
console . log ( cmd ) ;
724
- exec ( cmd , function ( ) {
733
+ function finish ( ) {
725
734
deleteTemporaryProjectOutput ( ) ;
726
- if ( i === 0 ) {
735
+ complete ( ) ;
736
+ }
737
+ exec ( cmd , function ( ) {
738
+ if ( lintFlag && i === 0 ) {
727
739
var lint = jake . Task [ 'lint' ] ;
728
740
lint . addListener ( 'complete' , function ( ) {
729
741
complete ( ) ;
730
742
} ) ;
731
743
lint . invoke ( ) ;
732
744
}
733
- else {
734
- complete ( ) ;
735
- }
736
- } ) ;
745
+ finish ( ) ;
746
+ } , finish ) ;
737
747
} ) ;
738
748
}
739
749
@@ -743,7 +753,7 @@ task("runtests-parallel", ["build-rules", "tests", builtLocalDirectory], functio
743
753
runConsoleTests ( 'min' , [ 'compiler' , 'conformance' , 'Projects' , 'fourslash' ] ) ;
744
754
} , { async : true } ) ;
745
755
746
- desc ( "Runs the tests using the built run.js file. Optional arguments are: t[ests]=regex r[eporter]=[list|spec|json|<more>] d[ebug]=true color[s]=false." ) ;
756
+ desc ( "Runs the tests using the built run.js file. Optional arguments are: t[ests]=regex r[eporter]=[list|spec|json|<more>] d[ebug]=true color[s]=false lint=true ." ) ;
747
757
task ( "runtests" , [ "build-rules" , "tests" , builtLocalDirectory ] , function ( ) {
748
758
runConsoleTests ( 'mocha-fivemat-progress-reporter' , [ ] ) ;
749
759
} , { async : true } ) ;
@@ -756,8 +766,8 @@ task("generate-code-coverage", ["tests", builtLocalDirectory], function () {
756
766
} , { async : true } ) ;
757
767
758
768
// Browser tests
759
- var nodeServerOutFile = ' tests/webTestServer.js'
760
- var nodeServerInFile = ' tests/webTestServer.ts'
769
+ var nodeServerOutFile = " tests/webTestServer.js" ;
770
+ var nodeServerInFile = " tests/webTestServer.ts" ;
761
771
compileFile ( nodeServerOutFile , [ nodeServerInFile ] , [ builtLocalDirectory , tscFile ] , [ ] , /*useBuiltCompiler:*/ true , { noOutFile : true } ) ;
762
772
763
773
desc ( "Runs browserify on run.js to produce a file suitable for running tests in the browser" ) ;
@@ -769,7 +779,7 @@ task("browserify", ["tests", builtLocalDirectory, nodeServerOutFile], function()
769
779
desc ( "Runs the tests using the built run.js file like 'jake runtests'. Syntax is jake runtests-browser. Additional optional parameters tests=[regex], port=, browser=[chrome|IE]" ) ;
770
780
task ( "runtests-browser" , [ "tests" , "browserify" , builtLocalDirectory , servicesFileInBrowserTest ] , function ( ) {
771
781
cleanTestDirs ( ) ;
772
- host = "node"
782
+ host = "node" ;
773
783
port = process . env . port || process . env . p || '8888' ;
774
784
browser = process . env . browser || process . env . b || "IE" ;
775
785
tests = process . env . test || process . env . tests || process . env . t ;
@@ -783,13 +793,13 @@ task("runtests-browser", ["tests", "browserify", builtLocalDirectory, servicesFi
783
793
}
784
794
785
795
tests = tests ? tests : '' ;
786
- var cmd = host + " tests/webTestServer.js " + port + " " + browser + " " + tests
796
+ var cmd = host + " tests/webTestServer.js " + port + " " + browser + " " + tests ;
787
797
console . log ( cmd ) ;
788
798
exec ( cmd ) ;
789
799
} , { async : true } ) ;
790
800
791
801
function getDiffTool ( ) {
792
- var program = process . env [ 'DIFF' ]
802
+ var program = process . env [ 'DIFF' ] ;
793
803
if ( ! program ) {
794
804
fail ( "Add the 'DIFF' environment variable to the path of the program you want to use." ) ;
795
805
}
@@ -818,11 +828,11 @@ task("tests-debug", ["setDebugMode", "tests"]);
818
828
// Makes the test results the new baseline
819
829
desc ( "Makes the most recent test results the new baseline, overwriting the old baseline" ) ;
820
830
task ( "baseline-accept" , function ( hardOrSoft ) {
821
- if ( ! hardOrSoft || hardOrSoft == "hard" ) {
831
+ if ( ! hardOrSoft || hardOrSoft === "hard" ) {
822
832
jake . rmRf ( refBaseline ) ;
823
833
fs . renameSync ( localBaseline , refBaseline ) ;
824
834
}
825
- else if ( hardOrSoft == "soft" ) {
835
+ else if ( hardOrSoft === "soft" ) {
826
836
var files = jake . readdirR ( localBaseline ) ;
827
837
for ( var i in files ) {
828
838
jake . cpR ( files [ i ] , refBaseline ) ;
@@ -901,14 +911,14 @@ task("update-sublime", ["local", serverFile], function() {
901
911
} ) ;
902
912
903
913
var tslintRuleDir = "scripts/tslint" ;
904
- var tslintRules = ( [
914
+ var tslintRules = [
905
915
"nextLineRule" ,
906
916
"preferConstRule" ,
907
917
"booleanTriviaRule" ,
908
918
"typeOperatorSpacingRule" ,
909
919
"noInOperatorRule" ,
910
920
"noIncrementDecrementRule"
911
- ] ) ;
921
+ ] ;
912
922
var tslintRulesFiles = tslintRules . map ( function ( p ) {
913
923
return path . join ( tslintRuleDir , p + ".ts" ) ;
914
924
} ) ;
@@ -933,7 +943,7 @@ function getLinterOptions() {
933
943
934
944
function lintFileContents ( options , path , contents ) {
935
945
var ll = new Linter ( path , contents , options ) ;
936
- console . log ( "Linting '" + path + "'." )
946
+ console . log ( "Linting '" + path + "'." ) ;
937
947
return ll . lint ( ) ;
938
948
}
939
949
@@ -954,6 +964,7 @@ function lintFileAsync(options, path, cb) {
954
964
955
965
var servicesLintTargets = [
956
966
"navigateTo.ts" ,
967
+ "navigationBar.ts" ,
957
968
"outliningElementsCollector.ts" ,
958
969
"patternMatcher.ts" ,
959
970
"services.ts" ,
@@ -963,20 +974,29 @@ var servicesLintTargets = [
963
974
return path . join ( servicesDirectory , s ) ;
964
975
} ) ;
965
976
var lintTargets = compilerSources
966
- . concat ( harnessCoreSources )
977
+ . concat ( harnessSources )
978
+ // Other harness sources
979
+ . concat ( [ "instrumenter.ts" ] . map ( function ( f ) { return path . join ( harnessDirectory , f ) } ) )
967
980
. concat ( serverCoreSources )
968
981
. concat ( tslintRulesFiles )
969
982
. concat ( servicesLintTargets ) ;
970
983
971
- desc ( "Runs tslint on the compiler sources" ) ;
984
+
985
+ desc ( "Runs tslint on the compiler sources. Optional arguments are: f[iles]=regex" ) ;
972
986
task ( "lint" , [ "build-rules" ] , function ( ) {
973
987
var lintOptions = getLinterOptions ( ) ;
974
988
var failed = 0 ;
989
+ var fileMatcher = RegExp ( process . env . f || process . env . file || process . env . files || "" ) ;
990
+ var done = { } ;
975
991
for ( var i in lintTargets ) {
976
- var result = lintFile ( lintOptions , lintTargets [ i ] ) ;
977
- if ( result . failureCount > 0 ) {
978
- console . log ( result . output ) ;
979
- failed += result . failureCount ;
992
+ var target = lintTargets [ i ] ;
993
+ if ( ! done [ target ] && fileMatcher . test ( target ) ) {
994
+ var result = lintFile ( lintOptions , target ) ;
995
+ if ( result . failureCount > 0 ) {
996
+ console . log ( result . output ) ;
997
+ failed += result . failureCount ;
998
+ }
999
+ done [ target ] = true ;
980
1000
}
981
1001
}
982
1002
if ( failed > 0 ) {
0 commit comments