@@ -39,25 +39,25 @@ Error.stackTraceLimit = 1000;
39
39
40
40
const cmdLineOptions = minimist ( process . argv . slice ( 2 ) , {
41
41
boolean : [ "debug" , "inspect" , "light" , "colors" , "lint" , "soft" ] ,
42
- string : [ "browser" , "tests" , "host" , "reporter" , "stackTraceLimit" ] ,
42
+ string : [ "browser" , "tests" , "host" , "reporter" , "stackTraceLimit" , "timeout" ] ,
43
43
alias : {
44
44
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" ,
48
48
r : "reporter" ,
49
- color : "colors" ,
50
- f : "files" ,
51
- file : "files" ,
49
+ c : "colors" , color : "colors" ,
50
+ f : "files" , file : "files" ,
52
51
w : "workers" ,
53
52
} ,
54
53
default : {
55
54
soft : false ,
56
55
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 ,
59
58
host : process . env . TYPESCRIPT_HOST || process . env . host || "node" ,
60
59
browser : process . env . browser || process . env . b || "IE" ,
60
+ timeout : process . env . timeout || 40000 ,
61
61
tests : process . env . test || process . env . tests || process . env . t ,
62
62
light : process . env . light || false ,
63
63
reporter : process . env . reporter || process . env . r ,
@@ -594,11 +594,11 @@ function restoreSavedNodeEnv() {
594
594
process . env . NODE_ENV = savedNodeEnv ;
595
595
}
596
596
597
- let testTimeout = 40000 ;
598
597
function runConsoleTests ( defaultReporter : string , runInParallel : boolean , done : ( e ?: any ) => void ) {
599
598
const lintFlag = cmdLineOptions [ "lint" ] ;
600
599
cleanTestDirs ( ( err ) => {
601
600
if ( err ) { console . error ( err ) ; failWithStatus ( err , 1 ) ; }
601
+ let testTimeout = cmdLineOptions [ "timeout" ] ;
602
602
const debug = cmdLineOptions [ "debug" ] ;
603
603
const inspect = cmdLineOptions [ "inspect" ] ;
604
604
const tests = cmdLineOptions [ "tests" ] ;
@@ -637,12 +637,6 @@ function runConsoleTests(defaultReporter: string, runInParallel: boolean, done:
637
637
// default timeout is 2sec which really should be enough, but maybe we just need a small amount longer
638
638
if ( ! runInParallel ) {
639
639
const args = [ ] ;
640
- if ( inspect ) {
641
- args . push ( "--inspect" ) ;
642
- }
643
- if ( inspect || debug ) {
644
- args . push ( "--debug-brk" ) ;
645
- }
646
640
args . push ( "-R" , reporter ) ;
647
641
if ( tests ) {
648
642
args . push ( "-g" , `"${ tests } "` ) ;
@@ -653,7 +647,15 @@ function runConsoleTests(defaultReporter: string, runInParallel: boolean, done:
653
647
else {
654
648
args . push ( "--no-colors" ) ;
655
649
}
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
+ }
657
659
args . push ( run ) ;
658
660
setNodeEnvToDevelopment ( ) ;
659
661
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 '
838
840
} ) ;
839
841
840
842
gulp . task ( "generate-code-coverage" , "Generates code coverage data via istanbul" , [ "tests" ] , ( done ) => {
843
+ const testTimeout = cmdLineOptions [ "timeout" ] ;
841
844
exec ( "istanbul" , [ "cover" , "node_modules/mocha/bin/_mocha" , "--" , "-R" , "min" , "-t" , testTimeout . toString ( ) , run ] , done , done ) ;
842
845
} ) ;
843
846
0 commit comments