From 0c0aaeb6bcac90e27cf76e4b8365bb103ab05d21 Mon Sep 17 00:00:00 2001 From: Dominic Gannaway Date: Mon, 6 Jul 2020 22:05:51 +0100 Subject: [PATCH] Handle test-cli failure case for CI (#19265) --- scripts/jest/jest-cli.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/jest/jest-cli.js b/scripts/jest/jest-cli.js index 7350f11df8..1b6eab1ae8 100644 --- a/scripts/jest/jest-cli.js +++ b/scripts/jest/jest-cli.js @@ -317,7 +317,17 @@ function main() { } // Run Jest. - spawn('node', args, {stdio: 'inherit', env: {...envars, ...process.env}}); + const jest = spawn('node', args, { + stdio: 'inherit', + env: {...envars, ...process.env}, + }); + // Ensure we close our process when we get a failure case. + jest.on('close', code => { + // Forward the exit code from the Jest process. + if (code === 1) { + process.exit(1); + } + }); } main();