@@ -39,25 +39,25 @@ Error.stackTraceLimit = 1000;
3939
4040const cmdLineOptions = minimist ( process . argv . slice ( 2 ) , {
4141 boolean : [ "debug" , "inspect" , "light" , "colors" , "lint" , "soft" ] ,
42- string : [ "browser" , "tests" , "host" , "reporter" , "stackTraceLimit" ] ,
42+ string : [ "browser" , "tests" , "host" , "reporter" , "stackTraceLimit" , "timeout" ] ,
4343 alias : {
4444 b : "browser" ,
45- d : "debug" ,
46- t : "tests " ,
47- test : "tests" ,
45+ d : "debug" , "debug-brk" : "debug" ,
46+ i : "inspect" , "inspect-brk" : "inspect ",
47+ t : "tests" , test : "tests" ,
4848 r : "reporter" ,
49- color : "colors" ,
50- f : "files" ,
51- file : "files" ,
49+ c : "colors" , color : "colors" ,
50+ f : "files" , file : "files" ,
5251 w : "workers" ,
5352 } ,
5453 default : {
5554 soft : false ,
5655 colors : process . env . colors || process . env . color || true ,
57- debug : process . env . debug || process . env . d ,
58- inspect : process . env . inspect ,
56+ debug : process . env . debug || process . env [ "debug-brk" ] || process . env . d ,
57+ inspect : process . env . inspect || process . env [ "inspect-brk" ] || process . env . i ,
5958 host : process . env . TYPESCRIPT_HOST || process . env . host || "node" ,
6059 browser : process . env . browser || process . env . b || "IE" ,
60+ timeout : process . env . timeout || 40000 ,
6161 tests : process . env . test || process . env . tests || process . env . t ,
6262 light : process . env . light || false ,
6363 reporter : process . env . reporter || process . env . r ,
@@ -594,11 +594,11 @@ function restoreSavedNodeEnv() {
594594 process . env . NODE_ENV = savedNodeEnv ;
595595}
596596
597- let testTimeout = 40000 ;
598597function runConsoleTests ( defaultReporter : string , runInParallel : boolean , done : ( e ?: any ) => void ) {
599598 const lintFlag = cmdLineOptions [ "lint" ] ;
600599 cleanTestDirs ( ( err ) => {
601600 if ( err ) { console . error ( err ) ; failWithStatus ( err , 1 ) ; }
601+ let testTimeout = cmdLineOptions [ "timeout" ] ;
602602 const debug = cmdLineOptions [ "debug" ] ;
603603 const inspect = cmdLineOptions [ "inspect" ] ;
604604 const tests = cmdLineOptions [ "tests" ] ;
@@ -637,12 +637,6 @@ function runConsoleTests(defaultReporter: string, runInParallel: boolean, done:
637637 // default timeout is 2sec which really should be enough, but maybe we just need a small amount longer
638638 if ( ! runInParallel ) {
639639 const args = [ ] ;
640- if ( inspect ) {
641- args . push ( "--inspect" ) ;
642- }
643- if ( inspect || debug ) {
644- args . push ( "--debug-brk" ) ;
645- }
646640 args . push ( "-R" , reporter ) ;
647641 if ( tests ) {
648642 args . push ( "-g" , `"${ tests } "` ) ;
@@ -653,7 +647,15 @@ function runConsoleTests(defaultReporter: string, runInParallel: boolean, done:
653647 else {
654648 args . push ( "--no-colors" ) ;
655649 }
656- args . push ( "-t" , testTimeout ) ;
650+ if ( inspect ) {
651+ args . unshift ( "--inspect-brk" ) ;
652+ }
653+ else if ( debug ) {
654+ args . unshift ( "--debug-brk" ) ;
655+ }
656+ else {
657+ args . push ( "-t" , testTimeout ) ;
658+ }
657659 args . push ( run ) ;
658660 setNodeEnvToDevelopment ( ) ;
659661 exec ( mocha , args , lintThenFinish , function ( e , status ) {
@@ -838,6 +840,7 @@ gulp.task("runtests-browser", "Runs the tests using the built run.js file like '
838840} ) ;
839841
840842gulp . task ( "generate-code-coverage" , "Generates code coverage data via istanbul" , [ "tests" ] , ( done ) => {
843+ const testTimeout = cmdLineOptions [ "timeout" ] ;
841844 exec ( "istanbul" , [ "cover" , "node_modules/mocha/bin/_mocha" , "--" , "-R" , "min" , "-t" , testTimeout . toString ( ) , run ] , done , done ) ;
842845} ) ;
843846
0 commit comments