@@ -96,15 +96,17 @@ var servicesSources = [
96
96
return path . join ( servicesDirectory , f ) ;
97
97
} ) ) ;
98
98
99
- var serverSources = [
99
+ var serverCoreSources = [
100
100
"node.d.ts" ,
101
101
"editorServices.ts" ,
102
102
"protocol.d.ts" ,
103
103
"session.ts" ,
104
104
"server.ts"
105
105
] . map ( function ( f ) {
106
106
return path . join ( serverDirectory , f ) ;
107
- } ) . concat ( servicesSources ) ;
107
+ } ) ;
108
+
109
+ var serverSources = serverCoreSources . concat ( servicesSources ) ;
108
110
109
111
var languageServiceLibrarySources = [
110
112
"editorServices.ts" ,
@@ -145,7 +147,8 @@ var harnessSources = harnessCoreSources.concat([
145
147
"transpile.ts" ,
146
148
"reuseProgramStructure.ts" ,
147
149
"cachingInServerLSHost.ts" ,
148
- "moduleResolution.ts"
150
+ "moduleResolution.ts" ,
151
+ "tsconfigParsing.ts"
149
152
] . map ( function ( f ) {
150
153
return path . join ( unittestsDirectory , f ) ;
151
154
} ) ) . concat ( [
@@ -164,7 +167,7 @@ var librarySourceMap = [
164
167
{ target : "lib.scriptHost.d.ts" , sources : [ "importcore.d.ts" , "scriptHost.d.ts" ] , } ,
165
168
{ target : "lib.d.ts" , sources : [ "core.d.ts" , "intl.d.ts" , "dom.generated.d.ts" , "webworker.importscripts.d.ts" , "scriptHost.d.ts" ] , } ,
166
169
{ target : "lib.core.es6.d.ts" , sources : [ "core.d.ts" , "es6.d.ts" ] } ,
167
- { target : "lib.es6.d.ts" , sources : [ "core .d.ts" , "es6 .d.ts" , "intl.d.ts" , "dom.generated.d.ts" , "dom.es6.d.ts" , "webworker.importscripts.d.ts" , "scriptHost.d.ts" ] } ,
170
+ { target : "lib.es6.d.ts" , sources : [ "es6 .d.ts" , "core .d.ts" , "intl.d.ts" , "dom.generated.d.ts" , "dom.es6.d.ts" , "webworker.importscripts.d.ts" , "scriptHost.d.ts" ] }
168
171
] ;
169
172
170
173
var libraryTargets = librarySourceMap . map ( function ( f ) {
@@ -225,7 +228,7 @@ var builtLocalCompiler = path.join(builtLocalDirectory, compilerFilename);
225
228
function compileFile ( outFile , sources , prereqs , prefixes , useBuiltCompiler , noOutFile , generateDeclarations , outDir , preserveConstEnums , keepComments , noResolve , stripInternal , callback ) {
226
229
file ( outFile , prereqs , function ( ) {
227
230
var compilerPath = useBuiltCompiler ? builtLocalCompiler : LKGCompiler ;
228
- var options = "--module commonjs --noImplicitAny --noEmitOnError" ;
231
+ var options = "--module commonjs --noImplicitAny --noEmitOnError --pretty " ;
229
232
230
233
// Keep comments when specifically requested
231
234
// or when in debug mode.
@@ -320,6 +323,8 @@ var processDiagnosticMessagesJs = path.join(scriptsDirectory, "processDiagnostic
320
323
var processDiagnosticMessagesTs = path . join ( scriptsDirectory , "processDiagnosticMessages.ts" ) ;
321
324
var diagnosticMessagesJson = path . join ( compilerDirectory , "diagnosticMessages.json" ) ;
322
325
var diagnosticInfoMapTs = path . join ( compilerDirectory , "diagnosticInformationMap.generated.ts" ) ;
326
+ var generatedDiagnosticMessagesJSON = path . join ( compilerDirectory , "diagnosticMessages.generated.json" ) ;
327
+ var builtGeneratedDiagnosticMessagesJSON = path . join ( builtLocalDirectory , "diagnosticMessages.generated.json" ) ;
323
328
324
329
file ( processDiagnosticMessagesTs ) ;
325
330
@@ -348,6 +353,12 @@ file(diagnosticInfoMapTs, [processDiagnosticMessagesJs, diagnosticMessagesJson],
348
353
ex . run ( ) ;
349
354
} , { async : true } ) ;
350
355
356
+ file ( builtGeneratedDiagnosticMessagesJSON , [ generatedDiagnosticMessagesJSON ] , function ( ) {
357
+ if ( fs . existsSync ( builtLocalDirectory ) ) {
358
+ jake . cpR ( generatedDiagnosticMessagesJSON , builtGeneratedDiagnosticMessagesJSON ) ;
359
+ }
360
+ } ) ;
361
+
351
362
desc ( "Generates a diagnostic file in TypeScript based on an input JSON file" ) ;
352
363
task ( "generate-diagnostics" , [ diagnosticInfoMapTs ] ) ;
353
364
@@ -444,6 +455,8 @@ compileFile(servicesFile, servicesSources,[builtLocalDirectory, copyright].conca
444
455
// Stanalone/web definition file using global 'ts' namespace
445
456
jake . cpR ( standaloneDefinitionsFile , nodeDefinitionsFile , { silent : true } ) ;
446
457
var definitionFileContents = fs . readFileSync ( nodeDefinitionsFile ) . toString ( ) ;
458
+ definitionFileContents = definitionFileContents . replace ( / ^ ( \s * ) ( e x p o r t ) ? c o n s t e n u m ( \S + ) { ( \s * ) $ / gm, '$1$2enum $3 {$4' ) ;
459
+ fs . writeFileSync ( standaloneDefinitionsFile , definitionFileContents ) ;
447
460
448
461
// Official node package definition file, pointed to by 'typings' in package.json
449
462
// Created by appending 'export = ts;' at the end of the standalone file to turn it into an external module
@@ -476,7 +489,7 @@ task("lssl", [lsslFile]);
476
489
477
490
// Local target to build the compiler and services
478
491
desc ( "Builds the full compiler and services" ) ;
479
- task ( "local" , [ "generate-diagnostics" , "lib" , tscFile , servicesFile , nodeDefinitionsFile , serverFile ] ) ;
492
+ task ( "local" , [ "generate-diagnostics" , "lib" , tscFile , servicesFile , nodeDefinitionsFile , serverFile , builtGeneratedDiagnosticMessagesJSON ] ) ;
480
493
481
494
// Local target to build only tsc.js
482
495
desc ( "Builds only the compiler" ) ;
@@ -626,9 +639,7 @@ function deleteTemporaryProjectOutput() {
626
639
}
627
640
}
628
641
629
- var testTimeout = 20000 ;
630
- desc ( "Runs the tests using the built run.js file. Syntax is jake runtests. Optional parameters 'host=', 'tests=[regex], reporter=[list|spec|json|<more>]', debug=true." ) ;
631
- task ( "runtests" , [ "build-rules" , "tests" , builtLocalDirectory ] , function ( ) {
642
+ function runConsoleTests ( defaultReporter , defaultSubsets , postLint ) {
632
643
cleanTestDirs ( ) ;
633
644
var debug = process . env . debug || process . env . d ;
634
645
tests = process . env . test || process . env . tests || process . env . t ;
@@ -638,7 +649,7 @@ task("runtests", ["build-rules", "tests", builtLocalDirectory], function() {
638
649
fs . unlinkSync ( testConfigFile ) ;
639
650
}
640
651
641
- if ( tests || light ) {
652
+ if ( tests || light ) {
642
653
writeTestConfigFile ( tests , light , testConfigFile ) ;
643
654
}
644
655
@@ -648,20 +659,48 @@ task("runtests", ["build-rules", "tests", builtLocalDirectory], function() {
648
659
649
660
colors = process . env . colors || process . env . color
650
661
colors = colors ? ' --no-colors ' : ' --colors ' ;
651
- tests = tests ? ' -g ' + tests : '' ;
652
- reporter = process . env . reporter || process . env . r || 'mocha-fivemat-progress-reporter' ;
662
+ reporter = process . env . reporter || process . env . r || defaultReporter ;
663
+
653
664
// timeout normally isn't necessary but Travis-CI has been timing out on compiler baselines occasionally
654
665
// default timeout is 2sec which really should be enough, but maybe we just need a small amount longer
655
- var cmd = "mocha" + ( debug ? " --debug-brk" : "" ) + " -R " + reporter + tests + colors + ' -t ' + testTimeout + ' ' + run ;
656
- console . log ( cmd ) ;
657
- exec ( cmd , function ( ) {
658
- deleteTemporaryProjectOutput ( ) ;
659
- var lint = jake . Task [ 'lint' ] ;
660
- lint . addListener ( 'complete' , function ( ) {
661
- complete ( ) ;
666
+ var subsetRegexes ;
667
+ if ( defaultSubsets . length === 0 ) {
668
+ subsetRegexes = [ tests ]
669
+ }
670
+ else {
671
+ var subsets = tests ? tests . split ( "|" ) : defaultSubsets ;
672
+ subsetRegexes = subsets . map ( function ( sub ) { return "^" + sub + ".*$" ; } ) ;
673
+ subsetRegexes . push ( "^(?!" + subsets . join ( "|" ) + ").*$" ) ;
674
+ }
675
+ subsetRegexes . forEach ( function ( subsetRegex ) {
676
+ tests = subsetRegex ? ' -g "' + subsetRegex + '"' : '' ;
677
+ var cmd = "mocha" + ( debug ? " --debug-brk" : "" ) + " -R " + reporter + tests + colors + ' -t ' + testTimeout + ' ' + run ;
678
+ console . log ( cmd ) ;
679
+ exec ( cmd , function ( ) {
680
+ deleteTemporaryProjectOutput ( ) ;
681
+ if ( postLint ) {
682
+ var lint = jake . Task [ 'lint' ] ;
683
+ lint . addListener ( 'complete' , function ( ) {
684
+ complete ( ) ;
685
+ } ) ;
686
+ lint . invoke ( ) ;
687
+ }
688
+ else {
689
+ complete ( ) ;
690
+ }
662
691
} ) ;
663
- lint . invoke ( ) ;
664
692
} ) ;
693
+ }
694
+
695
+ var testTimeout = 20000 ;
696
+ desc ( "Runs all the tests in parallel using the built run.js file. Optional arguments are: t[ests]=category1|category2|... d[ebug]=true." ) ;
697
+ task ( "runtests-parallel" , [ "build-rules" , "tests" , builtLocalDirectory ] , function ( ) {
698
+ runConsoleTests ( 'min' , [ 'compiler' , 'conformance' , 'Projects' , 'fourslash' ] ) ;
699
+ } , { async : true } ) ;
700
+
701
+ 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." ) ;
702
+ task ( "runtests" , [ "build-rules" , "tests" , builtLocalDirectory ] , function ( ) {
703
+ runConsoleTests ( 'mocha-fivemat-progress-reporter' , [ ] , /*postLint*/ true ) ;
665
704
} , { async : true } ) ;
666
705
667
706
desc ( "Generates code coverage data via instanbul" ) ;
@@ -820,7 +859,9 @@ var tslintRuleDir = "scripts/tslint";
820
859
var tslintRules = ( [
821
860
"nextLineRule" ,
822
861
"noNullRule" ,
823
- "booleanTriviaRule"
862
+ "preferConstRule" ,
863
+ "booleanTriviaRule" ,
864
+ "typeOperatorSpacingRule"
824
865
] ) ;
825
866
var tslintRulesFiles = tslintRules . map ( function ( p ) {
826
867
return path . join ( tslintRuleDir , p + ".ts" ) ;
@@ -863,7 +904,9 @@ function lintFileAsync(options, path, cb) {
863
904
} ) ;
864
905
}
865
906
866
- var lintTargets = compilerSources . concat ( harnessCoreSources ) ;
907
+ var lintTargets = compilerSources
908
+ . concat ( harnessCoreSources )
909
+ . concat ( serverCoreSources ) ;
867
910
868
911
desc ( "Runs tslint on the compiler sources" ) ;
869
912
task ( "lint" , [ "build-rules" ] , function ( ) {
0 commit comments