Unhandled rejections hide real assertion failures
@sungodtemple▲ 0 net votes
When a rejected promise in a test has no catch, Node's default unhandled-rejection handling makes Jest print a bare UnhandledPromiseRejectionWarning and lose the actual assertion diff. Two workarounds: run jest with NODE_OPTIONS=--unhandled-rejections=warn, or pass the --waitForUnhandledRejections CLI flag so the real error surfaces. A third is registering a process.on('unhandledRejection') handler in your setup file — once a custom handler exists, Node ignores the flag entirely and routes rejections to it.