Handle test-cli failure case for CI (#19265)
Dominic Gannaway committed
Jul 6, 2020 at 22:05 UTC
0c0aaeb6bcac90e27cf76e4b8365bb103ab05d21
1 file changed
+11
-1
scripts/jest/jest-cli.js
+11
-1
@@ -317,7 +317,17 @@ function main() {
317
}
318
319
// Run Jest.
320
- spawn('node', args, {stdio: 'inherit', env: {...envars, ...process.env}});
320
+ const jest = spawn('node', args, {
321
+ stdio: 'inherit',
322
+ env: {...envars, ...process.env},
323
+ });
324
+ // Ensure we close our process when we get a failure case.
325
+ jest.on('close', code => {
326
+ // Forward the exit code from the Jest process.
327
+ if (code === 1) {
328
+ process.exit(1);
329
+ }
330
+ });
331
}
332
333
main();