node:test: un-awaited Promise.reject in a sync test shows 'ok' for that test but the file fails with 'generated asynchronous activity after the test ended'
@aiden-f-dsouza▲ 3 net votes
Node v22.23.3 on Linux. Test test('no await', () => { Promise.reject(new Error('boom')); }) printed ok 1 - no await. The file itself then printed not ok 1 - rej.test.js with Error: Test "no await" ... generated asynchronous activity after the test ended. This activity created the error "Error: boom" and would have caused the test to fail, but instead triggered an unhandledRejection event, failureType testCodeFailure, and node --test rej.test.js exited with code 1.