@@ -27,6 +27,21 @@ if (program.runner) {
27
27
runner = program . runner ;
28
28
}
29
29
30
+ if ( typeof program . debugSynchronization === "boolean" ) {
31
+ program . debugSynchronization = 3000 ;
32
+ }
33
+
34
+ switch ( runner ) {
35
+ case 'mocha' :
36
+ runMocha ( ) ;
37
+ break ;
38
+ case 'jest' :
39
+ runJest ( ) ;
40
+ break ;
41
+ default :
42
+ throw new Error ( `${ runner } is not supported in detox cli tools. You can still run your tests with the runner's own cli tool` ) ;
43
+ }
44
+
30
45
function runMocha ( ) {
31
46
const loglevel = program . loglevel ? `--loglevel ${ program . loglevel } ` : '' ;
32
47
const configuration = program . configuration ? `--configuration ${ program . configuration } ` : '' ;
@@ -44,31 +59,17 @@ function runMocha() {
44
59
function runJest ( ) {
45
60
const command = `node_modules/.bin/jest ${ testFolder } --runInBand` ;
46
61
console . log ( command ) ;
62
+
47
63
cp . execSync ( command , {
48
64
stdio : 'inherit' ,
49
- env : {
50
- ... process . env ,
51
- configuration : program . configuration ,
52
- loglevel : program . loglevel ,
53
- cleanup : program . cleanup ,
54
- reuse : program . reuse ,
55
- debugSynchronization : program . debugSynchronization ,
56
- artifactsLocation : program . artifactsLocation
57
- }
65
+ env : Object . assign ( { } ,
66
+ process . env , {
67
+ configuration : program . configuration ,
68
+ loglevel : program . loglevel ,
69
+ cleanup : program . cleanup ,
70
+ reuse : program . reuse ,
71
+ debugSynchronization : program . debugSynchronization ,
72
+ artifactsLocation : program . artifactsLocation
73
+ } )
58
74
} ) ;
59
- }
60
-
61
- if ( typeof program . debugSynchronization === "boolean" ) {
62
- program . debugSynchronization = 3000 ;
63
- }
64
-
65
- switch ( runner ) {
66
- case 'mocha' :
67
- runMocha ( ) ;
68
- break ;
69
- case 'jest' :
70
- runJest ( ) ;
71
- break ;
72
- default :
73
- throw new Error ( `${ runner } is not supported in detox cli tools. You can still run your tests with the runner's own cli tool` ) ;
74
- }
75
+ }
0 commit comments