From e078cd929624250132b487d0a091420de0a49f93 Mon Sep 17 00:00:00 2001 From: anatawa12 Date: Tue, 27 May 2025 15:07:47 +0900 Subject: [PATCH] fix: jest.js exits with zero value even if underlying jest exited with non-zero value (#16111) --- packages/backend/jest.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/backend/jest.js b/packages/backend/jest.js index 0cb2c2ab77..0e761d8c92 100644 --- a/packages/backend/jest.js +++ b/packages/backend/jest.js @@ -17,4 +17,15 @@ args.push(...[ ...process.argv.slice(2), ]); -child_process.spawn(process.execPath, args, { stdio: 'inherit' }); +const child = child_process.spawn(process.execPath, args, { stdio: 'inherit' }); +child.on('error', (err) => { + console.error('Failed to start Jest:', err); + process.exit(1); +}); +child.on('exit', (code, signal) => { + if (code === null) { + process.exit(128 + signal); + } else { + process.exit(code); + } +});