@@ -276,6 +276,7 @@ var builtLocalCompiler = path.join(builtLocalDirectory, compilerFilename);
276276 * @param {boolean } opts.noResolve: true if compiler should not include non-rooted files in compilation
277277 * @param {boolean } opts.stripInternal: true if compiler should remove declarations marked as @internal
278278 * @param {boolean } opts.noMapRoot: true if compiler omit mapRoot option
279+ * @param {boolean } opts.inlineSourceMap: true if compiler should inline sourceMap
279280 * @param callback: a function to execute after the compilation process ends
280281 */
281282function compileFile ( outFile , sources , prereqs , prefixes , useBuiltCompiler , opts , callback ) {
@@ -313,9 +314,13 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, opts
313314 }
314315
315316 if ( useDebugMode ) {
316- options += " -sourcemap" ;
317- if ( ! opts . noMapRoot ) {
318- options += " -mapRoot file:///" + path . resolve ( path . dirname ( outFile ) ) ;
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+ }
319324 }
320325 } else {
321326 options += " --newLine LF" ;
@@ -495,7 +500,13 @@ var nodeStandaloneDefinitionsFile = path.join(builtLocalDirectory, "typescript_s
495500compileFile ( servicesFile , servicesSources , [ builtLocalDirectory , copyright ] . concat ( servicesSources ) ,
496501 /*prefixes*/ [ copyright ] ,
497502 /*useBuiltCompiler*/ true ,
498- { 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+ } ,
499510 /*callback*/ function ( ) {
500511 jake . cpR ( servicesFile , nodePackageFile , { silent : true } ) ;
501512
@@ -518,16 +529,21 @@ compileFile(servicesFile, servicesSources,[builtLocalDirectory, copyright].conca
518529 fs . writeFileSync ( nodeStandaloneDefinitionsFile , nodeStandaloneDefinitionsFileContents ) ;
519530 } ) ;
520531
521- compileFile ( servicesFileInBrowserTest , servicesSources , [ builtLocalDirectory , copyright ] . concat ( servicesSources ) ,
522- /*prefixes*/ [ copyright ] ,
523- /*useBuiltCompiler*/ true ,
524- { noOutFile : false , generateDeclarations : true , preserveConstEnums : true , keepComments : true , noResolve : false , stripInternal : true , noMapRoot : true } ,
525- /*callback*/ function ( ) {
526- var content = fs . readFileSync ( servicesFileInBrowserTest ) . toString ( ) ;
527- var i = content . lastIndexOf ( "\n" ) ;
528- fs . writeFileSync ( servicesFileInBrowserTest , content . substring ( 0 , i ) + "\r\n//# sourceURL=../built/local/typeScriptServices.js" + content . substring ( i ) ) ;
529- } ) ;
530-
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+ } ) ;
531547
532548var serverFile = path . join ( builtLocalDirectory , "tsserver.js" ) ;
533549compileFile ( serverFile , serverSources , [ builtLocalDirectory , copyright ] . concat ( serverSources ) , /*prefixes*/ [ copyright ] , /*useBuiltCompiler*/ true ) ;
@@ -628,7 +644,13 @@ directory(builtLocalDirectory);
628644
629645// Task to build the tests infrastructure using the built compiler
630646var run = path . join ( builtLocalDirectory , "run.js" ) ;
631- 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 } ) ;
632654
633655var internalTests = "internal/" ;
634656
@@ -732,24 +754,34 @@ function runConsoleTests(defaultReporter, runInParallel) {
732754 colors = process . env . colors || process . env . color ;
733755 colors = colors ? ' --no-colors ' : ' --colors ' ;
734756 reporter = process . env . reporter || process . env . r || defaultReporter ;
757+ var bail = ( process . env . bail || process . env . b ) ? "--bail" : "" ;
735758 var lintFlag = process . env . lint !== 'false' ;
736759
737760 // timeout normally isn't necessary but Travis-CI has been timing out on compiler baselines occasionally
738761 // default timeout is 2sec which really should be enough, but maybe we just need a small amount longer
739762 if ( ! runInParallel ) {
740763 tests = tests ? ' -g "' + tests + '"' : '' ;
741- 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 ;
742765 console . log ( cmd ) ;
766+
767+ var savedNodeEnv = process . env . NODE_ENV ;
768+ process . env . NODE_ENV = "development" ;
743769 exec ( cmd , function ( ) {
770+ process . env . NODE_ENV = savedNodeEnv ;
744771 runLinter ( ) ;
745772 finish ( ) ;
746773 } , function ( e , status ) {
774+ process . env . NODE_ENV = savedNodeEnv ;
747775 finish ( status ) ;
748776 } ) ;
749777
750778 }
751779 else {
780+ var savedNodeEnv = process . env . NODE_ENV ;
781+ process . env . NODE_ENV = "development" ;
752782 runTestsInParallel ( taskConfigsFolder , run , { testTimeout : testTimeout , noColors : colors === " --no-colors " } , function ( err ) {
783+ process . env . NODE_ENV = savedNodeEnv ;
784+
753785 // last worker clean everything and runs linter in case if there were no errors
754786 deleteTemporaryProjectOutput ( ) ;
755787 jake . rmRf ( taskConfigsFolder ) ;
@@ -794,7 +826,7 @@ task("runtests-parallel", ["build-rules", "tests", builtLocalDirectory], functio
794826 runConsoleTests ( 'min' , /*runInParallel*/ true ) ;
795827} , { async : true } ) ;
796828
797- 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 ." ) ;
798830task ( "runtests" , [ "build-rules" , "tests" , builtLocalDirectory ] , function ( ) {
799831 runConsoleTests ( 'mocha-fivemat-progress-reporter' , /*runInParallel*/ false ) ;
800832} , { async : true } ) ;
@@ -813,7 +845,7 @@ compileFile(nodeServerOutFile, [nodeServerInFile], [builtLocalDirectory, tscFile
813845
814846desc ( "Runs browserify on run.js to produce a file suitable for running tests in the browser" ) ;
815847task ( "browserify" , [ "tests" , builtLocalDirectory , nodeServerOutFile ] , function ( ) {
816- var cmd = 'browserify built/local/run.js -o built/local/bundle.js' ;
848+ var cmd = 'browserify built/local/run.js -d - o built/local/bundle.js' ;
817849 exec ( cmd ) ;
818850} , { async : true } ) ;
819851
0 commit comments