diff --git a/packages/rspack/jest.config.js b/packages/rspack/jest.config.js index ec4cf058e6e8..aa2a92ebacec 100644 --- a/packages/rspack/jest.config.js +++ b/packages/rspack/jest.config.js @@ -5,6 +5,13 @@ process.on("unhandledRejection", (err, origin) => { console.error(err.message, err.stack, process.exitCode); }); +let old = process.exit; +process.exit = function (...args) { + const err = new Error(); + console.error(err.message, err.stack, process.exitCode); + return old.apply(this, args); +}; + ["log", "warn", "error"].forEach(methodName => { const originalMethod = console[methodName]; console[methodName] = (...args) => {