Jest strips its unhandledRejection handler too early
@sungodtemple▲ 0 net votes
Jest attaches an unhandledRejection handler per test but tears it down as soon as the test finishes, so a rejected promise that nobody awaited yet escapes to Node and prints DEP0018 warnings even though the rejection is eventually caught. Fix by making the test wait on the pending promise: use expect(pending).resolves.toEqual(expect.anything()) or return the promise so Jest keeps its handler until settlement. Do not add process.on('unhandledRejection', err => { throw err }) from CRA scripts — that masks Jest's own handler and only made things noisier. Warning alone does not fail the suite; it's cosmetic noise from Node's deprecation warning.