@@ -276,6 +276,7 @@ var builtLocalCompiler = path.join(builtLocalDirectory, compilerFilename);
276
276
* @param {boolean } opts.noResolve: true if compiler should not include non-rooted files in compilation
277
277
* @param {boolean } opts.stripInternal: true if compiler should remove declarations marked as @internal
278
278
* @param {boolean } opts.noMapRoot: true if compiler omit mapRoot option
279
+ * @param {boolean } opts.inlineSourceMap: true if compiler should inline sourceMap
279
280
* @param callback: a function to execute after the compilation process ends
280
281
*/
281
282
function compileFile ( outFile , sources , prereqs , prefixes , useBuiltCompiler , opts , callback ) {
@@ -313,7 +314,14 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, opts
313
314
}
314
315
315
316
if ( useDebugMode ) {
316
- options += " --inlineSourceMap --inlineSources" ;
317
+ if ( opts . inlineSourceMap ) {
318
+ options += " --inlineSourceMap --inlineSources" ;
319
+ } else {
320
+ options += " -sourcemap" ;
321
+ if ( ! opts . noMapRoot ) {
322
+ options += " -mapRoot file:///" + path . resolve ( path . dirname ( outFile ) ) ;
323
+ }
324
+ }
317
325
} else {
318
326
options += " --newLine LF" ;
319
327
}
@@ -483,6 +491,7 @@ var tscFile = path.join(builtLocalDirectory, compilerFilename);
483
491
compileFile ( tscFile , compilerSources , [ builtLocalDirectory , copyright ] . concat ( compilerSources ) , [ copyright ] , /*useBuiltCompiler:*/ false ) ;
484
492
485
493
var servicesFile = path . join ( builtLocalDirectory , "typescriptServices.js" ) ;
494
+ var servicesFileInBrowserTest = path . join ( builtLocalDirectory , "typescriptServicesInBrowserTest.js" ) ;
486
495
var standaloneDefinitionsFile = path . join ( builtLocalDirectory , "typescriptServices.d.ts" ) ;
487
496
var nodePackageFile = path . join ( builtLocalDirectory , "typescript.js" ) ;
488
497
var nodeDefinitionsFile = path . join ( builtLocalDirectory , "typescript.d.ts" ) ;
@@ -491,7 +500,13 @@ var nodeStandaloneDefinitionsFile = path.join(builtLocalDirectory, "typescript_s
491
500
compileFile ( servicesFile , servicesSources , [ builtLocalDirectory , copyright ] . concat ( servicesSources ) ,
492
501
/*prefixes*/ [ copyright ] ,
493
502
/*useBuiltCompiler*/ true ,
494
- { noOutFile : false , generateDeclarations : true , preserveConstEnums : true , keepComments : true , noResolve : false , stripInternal : true } ,
503
+ /*opts*/ { noOutFile : false ,
504
+ generateDeclarations : true ,
505
+ preserveConstEnums : true ,
506
+ keepComments : true ,
507
+ noResolve : false ,
508
+ stripInternal : true
509
+ } ,
495
510
/*callback*/ function ( ) {
496
511
jake . cpR ( servicesFile , nodePackageFile , { silent : true } ) ;
497
512
@@ -514,6 +529,21 @@ compileFile(servicesFile, servicesSources,[builtLocalDirectory, copyright].conca
514
529
fs . writeFileSync ( nodeStandaloneDefinitionsFile , nodeStandaloneDefinitionsFileContents ) ;
515
530
} ) ;
516
531
532
+ compileFile (
533
+ servicesFileInBrowserTest ,
534
+ servicesSources ,
535
+ [ builtLocalDirectory , copyright ] . concat ( servicesSources ) ,
536
+ /*prefixes*/ [ copyright ] ,
537
+ /*useBuiltCompiler*/ true ,
538
+ { noOutFile : false ,
539
+ generateDeclarations : true ,
540
+ preserveConstEnums : true ,
541
+ keepComments : true ,
542
+ noResolve : false ,
543
+ stripInternal : true ,
544
+ noMapRoot : true ,
545
+ inlineSourceMap : true
546
+ } ) ;
517
547
518
548
var serverFile = path . join ( builtLocalDirectory , "tsserver.js" ) ;
519
549
compileFile ( serverFile , serverSources , [ builtLocalDirectory , copyright ] . concat ( serverSources ) , /*prefixes*/ [ copyright ] , /*useBuiltCompiler*/ true ) ;
@@ -614,7 +644,13 @@ directory(builtLocalDirectory);
614
644
615
645
// Task to build the tests infrastructure using the built compiler
616
646
var run = path . join ( builtLocalDirectory , "run.js" ) ;
617
- compileFile ( run , harnessSources , [ builtLocalDirectory , tscFile ] . concat ( libraryTargets ) . concat ( harnessSources ) , [ ] , /*useBuiltCompiler:*/ true ) ;
647
+ compileFile (
648
+ /*outFile*/ run ,
649
+ /*source*/ harnessSources ,
650
+ /*prereqs*/ [ builtLocalDirectory , tscFile ] . concat ( libraryTargets ) . concat ( harnessSources ) ,
651
+ /*prefixes*/ [ ] ,
652
+ /*useBuiltCompiler:*/ true ,
653
+ /*opts*/ { inlineSourceMap : true } ) ;
618
654
619
655
var internalTests = "internal/" ;
620
656
@@ -718,24 +754,34 @@ function runConsoleTests(defaultReporter, runInParallel) {
718
754
colors = process . env . colors || process . env . color ;
719
755
colors = colors ? ' --no-colors ' : ' --colors ' ;
720
756
reporter = process . env . reporter || process . env . r || defaultReporter ;
757
+ var bail = ( process . env . bail || process . env . b ) ? "--bail" : "" ;
721
758
var lintFlag = process . env . lint !== 'false' ;
722
759
723
760
// timeout normally isn't necessary but Travis-CI has been timing out on compiler baselines occasionally
724
761
// default timeout is 2sec which really should be enough, but maybe we just need a small amount longer
725
762
if ( ! runInParallel ) {
726
763
tests = tests ? ' -g "' + tests + '"' : '' ;
727
- var cmd = "mocha" + ( debug ? " --debug-brk" : "" ) + " -R " + reporter + tests + colors + ' -t ' + testTimeout + ' ' + run ;
764
+ var cmd = "mocha" + ( debug ? " --debug-brk" : "" ) + " -R " + reporter + tests + colors + bail + ' -t ' + testTimeout + ' ' + run ;
728
765
console . log ( cmd ) ;
766
+
767
+ var savedNodeEnv = process . env . NODE_ENV ;
768
+ process . env . NODE_ENV = "development" ;
729
769
exec ( cmd , function ( ) {
770
+ process . env . NODE_ENV = savedNodeEnv ;
730
771
runLinter ( ) ;
731
772
finish ( ) ;
732
773
} , function ( e , status ) {
774
+ process . env . NODE_ENV = savedNodeEnv ;
733
775
finish ( status ) ;
734
776
} ) ;
735
777
736
778
}
737
779
else {
780
+ var savedNodeEnv = process . env . NODE_ENV ;
781
+ process . env . NODE_ENV = "development" ;
738
782
runTestsInParallel ( taskConfigsFolder , run , { testTimeout : testTimeout , noColors : colors === " --no-colors " } , function ( err ) {
783
+ process . env . NODE_ENV = savedNodeEnv ;
784
+
739
785
// last worker clean everything and runs linter in case if there were no errors
740
786
deleteTemporaryProjectOutput ( ) ;
741
787
jake . rmRf ( taskConfigsFolder ) ;
@@ -780,7 +826,7 @@ task("runtests-parallel", ["build-rules", "tests", builtLocalDirectory], functio
780
826
runConsoleTests ( 'min' , /*runInParallel*/ true ) ;
781
827
} , { async : true } ) ;
782
828
783
- 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." ) ;
829
+ 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 bail=false ." ) ;
784
830
task ( "runtests" , [ "build-rules" , "tests" , builtLocalDirectory ] , function ( ) {
785
831
runConsoleTests ( 'mocha-fivemat-progress-reporter' , /*runInParallel*/ false ) ;
786
832
} , { async : true } ) ;
@@ -804,7 +850,7 @@ task("browserify", ["tests", builtLocalDirectory, nodeServerOutFile], function()
804
850
} , { async : true } ) ;
805
851
806
852
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]" ) ;
807
- task ( "runtests-browser" , [ "tests" , "browserify" , builtLocalDirectory , servicesFile ] , function ( ) {
853
+ task ( "runtests-browser" , [ "tests" , "browserify" , builtLocalDirectory , servicesFileInBrowserTest ] , function ( ) {
808
854
cleanTestDirs ( ) ;
809
855
host = "node" ;
810
856
port = process . env . port || process . env . p || '8888' ;
0 commit comments