@@ -96,15 +96,17 @@ var servicesSources = [
9696 return path . join ( servicesDirectory , f ) ;
9797} ) ) ;
9898
99- var serverSources = [
99+ var serverCoreSources = [
100100 "node.d.ts" ,
101101 "editorServices.ts" ,
102102 "protocol.d.ts" ,
103103 "session.ts" ,
104104 "server.ts"
105105] . map ( function ( f ) {
106106 return path . join ( serverDirectory , f ) ;
107- } ) . concat ( servicesSources ) ;
107+ } ) ;
108+
109+ var serverSources = serverCoreSources . concat ( servicesSources ) ;
108110
109111var languageServiceLibrarySources = [
110112 "editorServices.ts" ,
@@ -145,7 +147,8 @@ var harnessSources = harnessCoreSources.concat([
145147 "transpile.ts" ,
146148 "reuseProgramStructure.ts" ,
147149 "cachingInServerLSHost.ts" ,
148- "moduleResolution.ts"
150+ "moduleResolution.ts" ,
151+ "tsconfigParsing.ts"
149152] . map ( function ( f ) {
150153 return path . join ( unittestsDirectory , f ) ;
151154} ) ) . concat ( [
@@ -164,7 +167,7 @@ var librarySourceMap = [
164167 { target : "lib.scriptHost.d.ts" , sources : [ "importcore.d.ts" , "scriptHost.d.ts" ] , } ,
165168 { target : "lib.d.ts" , sources : [ "core.d.ts" , "intl.d.ts" , "dom.generated.d.ts" , "webworker.importscripts.d.ts" , "scriptHost.d.ts" ] , } ,
166169 { 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" ] }
168171] ;
169172
170173var libraryTargets = librarySourceMap . map ( function ( f ) {
@@ -225,7 +228,7 @@ var builtLocalCompiler = path.join(builtLocalDirectory, compilerFilename);
225228function compileFile ( outFile , sources , prereqs , prefixes , useBuiltCompiler , noOutFile , generateDeclarations , outDir , preserveConstEnums , keepComments , noResolve , stripInternal , callback ) {
226229 file ( outFile , prereqs , function ( ) {
227230 var compilerPath = useBuiltCompiler ? builtLocalCompiler : LKGCompiler ;
228- var options = "--module commonjs --noImplicitAny --noEmitOnError " ;
231+ var options = "--noImplicitAny --noEmitOnError --pretty " ;
229232
230233 // Keep comments when specifically requested
231234 // or when in debug mode.
@@ -248,6 +251,9 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, noOu
248251 if ( ! noOutFile ) {
249252 options += " --out " + outFile ;
250253 }
254+ else {
255+ options += " --module commonjs"
256+ }
251257
252258 if ( noResolve ) {
253259 options += " --noResolve" ;
@@ -320,6 +326,8 @@ var processDiagnosticMessagesJs = path.join(scriptsDirectory, "processDiagnostic
320326var processDiagnosticMessagesTs = path . join ( scriptsDirectory , "processDiagnosticMessages.ts" ) ;
321327var diagnosticMessagesJson = path . join ( compilerDirectory , "diagnosticMessages.json" ) ;
322328var diagnosticInfoMapTs = path . join ( compilerDirectory , "diagnosticInformationMap.generated.ts" ) ;
329+ var generatedDiagnosticMessagesJSON = path . join ( compilerDirectory , "diagnosticMessages.generated.json" ) ;
330+ var builtGeneratedDiagnosticMessagesJSON = path . join ( builtLocalDirectory , "diagnosticMessages.generated.json" ) ;
323331
324332file ( processDiagnosticMessagesTs ) ;
325333
@@ -348,6 +356,12 @@ file(diagnosticInfoMapTs, [processDiagnosticMessagesJs, diagnosticMessagesJson],
348356 ex . run ( ) ;
349357} , { async : true } ) ;
350358
359+ file ( builtGeneratedDiagnosticMessagesJSON , [ generatedDiagnosticMessagesJSON ] , function ( ) {
360+ if ( fs . existsSync ( builtLocalDirectory ) ) {
361+ jake . cpR ( generatedDiagnosticMessagesJSON , builtGeneratedDiagnosticMessagesJSON ) ;
362+ }
363+ } ) ;
364+
351365desc ( "Generates a diagnostic file in TypeScript based on an input JSON file" ) ;
352366task ( "generate-diagnostics" , [ diagnosticInfoMapTs ] ) ;
353367
@@ -444,6 +458,8 @@ compileFile(servicesFile, servicesSources,[builtLocalDirectory, copyright].conca
444458 // Stanalone/web definition file using global 'ts' namespace
445459 jake . cpR ( standaloneDefinitionsFile , nodeDefinitionsFile , { silent : true } ) ;
446460 var definitionFileContents = fs . readFileSync ( nodeDefinitionsFile ) . toString ( ) ;
461+ 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' ) ;
462+ fs . writeFileSync ( standaloneDefinitionsFile , definitionFileContents ) ;
447463
448464 // Official node package definition file, pointed to by 'typings' in package.json
449465 // Created by appending 'export = ts;' at the end of the standalone file to turn it into an external module
@@ -476,7 +492,7 @@ task("lssl", [lsslFile]);
476492
477493// Local target to build the compiler and services
478494desc ( "Builds the full compiler and services" ) ;
479- task ( "local" , [ "generate-diagnostics" , "lib" , tscFile , servicesFile , nodeDefinitionsFile , serverFile ] ) ;
495+ task ( "local" , [ "generate-diagnostics" , "lib" , tscFile , servicesFile , nodeDefinitionsFile , serverFile , builtGeneratedDiagnosticMessagesJSON ] ) ;
480496
481497// Local target to build only tsc.js
482498desc ( "Builds only the compiler" ) ;
@@ -626,9 +642,7 @@ function deleteTemporaryProjectOutput() {
626642 }
627643}
628644
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 ( ) {
645+ function runConsoleTests ( defaultReporter , defaultSubsets , postLint ) {
632646 cleanTestDirs ( ) ;
633647 var debug = process . env . debug || process . env . d ;
634648 tests = process . env . test || process . env . tests || process . env . t ;
@@ -638,7 +652,7 @@ task("runtests", ["build-rules", "tests", builtLocalDirectory], function() {
638652 fs . unlinkSync ( testConfigFile ) ;
639653 }
640654
641- if ( tests || light ) {
655+ if ( tests || light ) {
642656 writeTestConfigFile ( tests , light , testConfigFile ) ;
643657 }
644658
@@ -648,20 +662,48 @@ task("runtests", ["build-rules", "tests", builtLocalDirectory], function() {
648662
649663 colors = process . env . colors || process . env . color
650664 colors = colors ? ' --no-colors ' : ' --colors ' ;
651- tests = tests ? ' -g ' + tests : '' ;
652- reporter = process . env . reporter || process . env . r || 'mocha-fivemat-progress-reporter' ;
665+ reporter = process . env . reporter || process . env . r || defaultReporter ;
666+
653667 // timeout normally isn't necessary but Travis-CI has been timing out on compiler baselines occasionally
654668 // 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 ( ) ;
669+ var subsetRegexes ;
670+ if ( defaultSubsets . length === 0 ) {
671+ subsetRegexes = [ tests ]
672+ }
673+ else {
674+ var subsets = tests ? tests . split ( "|" ) : defaultSubsets ;
675+ subsetRegexes = subsets . map ( function ( sub ) { return "^" + sub + ".*$" ; } ) ;
676+ subsetRegexes . push ( "^(?!" + subsets . join ( "|" ) + ").*$" ) ;
677+ }
678+ subsetRegexes . forEach ( function ( subsetRegex ) {
679+ tests = subsetRegex ? ' -g "' + subsetRegex + '"' : '' ;
680+ var cmd = "mocha" + ( debug ? " --debug-brk" : "" ) + " -R " + reporter + tests + colors + ' -t ' + testTimeout + ' ' + run ;
681+ console . log ( cmd ) ;
682+ exec ( cmd , function ( ) {
683+ deleteTemporaryProjectOutput ( ) ;
684+ if ( postLint ) {
685+ var lint = jake . Task [ 'lint' ] ;
686+ lint . addListener ( 'complete' , function ( ) {
687+ complete ( ) ;
688+ } ) ;
689+ lint . invoke ( ) ;
690+ }
691+ else {
692+ complete ( ) ;
693+ }
662694 } ) ;
663- lint . invoke ( ) ;
664695 } ) ;
696+ }
697+
698+ var testTimeout = 20000 ;
699+ desc ( "Runs all the tests in parallel using the built run.js file. Optional arguments are: t[ests]=category1|category2|... d[ebug]=true." ) ;
700+ task ( "runtests-parallel" , [ "build-rules" , "tests" , builtLocalDirectory ] , function ( ) {
701+ runConsoleTests ( 'min' , [ 'compiler' , 'conformance' , 'Projects' , 'fourslash' ] ) ;
702+ } , { async : true } ) ;
703+
704+ 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." ) ;
705+ task ( "runtests" , [ "build-rules" , "tests" , builtLocalDirectory ] , function ( ) {
706+ runConsoleTests ( 'mocha-fivemat-progress-reporter' , [ ] , /*postLint*/ true ) ;
665707} , { async : true } ) ;
666708
667709desc ( "Generates code coverage data via instanbul" ) ;
@@ -820,7 +862,9 @@ var tslintRuleDir = "scripts/tslint";
820862var tslintRules = ( [
821863 "nextLineRule" ,
822864 "noNullRule" ,
823- "booleanTriviaRule"
865+ "preferConstRule" ,
866+ "booleanTriviaRule" ,
867+ "typeOperatorSpacingRule"
824868] ) ;
825869var tslintRulesFiles = tslintRules . map ( function ( p ) {
826870 return path . join ( tslintRuleDir , p + ".ts" ) ;
@@ -863,7 +907,9 @@ function lintFileAsync(options, path, cb) {
863907 } ) ;
864908}
865909
866- var lintTargets = compilerSources . concat ( harnessCoreSources ) ;
910+ var lintTargets = compilerSources
911+ . concat ( harnessCoreSources )
912+ . concat ( serverCoreSources ) ;
867913
868914desc ( "Runs tslint on the compiler sources" ) ;
869915task ( "lint" , [ "build-rules" ] , function ( ) {
0 commit comments