diff --git a/test/parallel/test-async-wrap-post-did-throw.js b/test/parallel/test-async-wrap-post-did-throw.js index 9781983f58987e..a3a94fb8f225e7 100644 --- a/test/parallel/test-async-wrap-post-did-throw.js +++ b/test/parallel/test-async-wrap-post-did-throw.js @@ -10,6 +10,8 @@ process.on('uncaughtException', (e) => { assert.equal(e.message, 'oh noes!', 'error messages do not match'); }); + + process.on('exit', () => { process.removeAllListeners('uncaughtException'); assert.equal(uncaughtExceptionCount, 1);