Skip to content

Commit a82cf8e

Browse files
committed
detox-test cli: replace spread operator with object.assign to support early versions of Node
1 parent 7ca9db1 commit a82cf8e

File tree

1 file changed

+26
-25
lines changed

1 file changed

+26
-25
lines changed

detox/local-cli/detox-test.js

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,21 @@ if (program.runner) {
2727
runner = program.runner;
2828
}
2929

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+
3045
function runMocha() {
3146
const loglevel = program.loglevel ? `--loglevel ${program.loglevel}` : '';
3247
const configuration = program.configuration ? `--configuration ${program.configuration}` : '';
@@ -44,31 +59,17 @@ function runMocha() {
4459
function runJest() {
4560
const command = `node_modules/.bin/jest ${testFolder} --runInBand`;
4661
console.log(command);
62+
4763
cp.execSync(command, {
4864
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+
})
5874
});
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

Comments
 (0)