-
-
Couldn't load subscription status.
- Fork 3.1k
Open
Labels
status: in triagea maintainer should (re-)triage (review) this issuea maintainer should (re-)triage (review) this issuetype: buga defect, confirmed by a maintainera defect, confirmed by a maintainer
Description
Bug Report Checklist
- I have read and agree to Mocha's Code of Conduct and Contributing Guidelines
- I have searched for related issues and issues with the
faqlabel, but none matched my issue. - I have 'smoke tested' the code to be tested by running it outside the real test suite to get a better sense of whether the problem is in the code under test, my usage of Mocha, or Mocha itself.
- I want to provide a PR to resolve this
Expected
Tests should fail if there's an unhandled rejection with no process-level listener.
Actual
As demonstrated in #5505, a test which throws an unhandled promise rejection inside runner code will cause the mocha process to exit with status code 0.
Minimal, Reproducible Example
$ echo 'it("t", async () => { require("node:assert").deepEqual(Object.create(null), { a:1 }); });' > demo.js; npx mocha demo.js; echo $?
0Versions
$ node --version
v22.14.0
$ npx mocha --version
11.7.4
Additional Info
No response
Metadata
Metadata
Assignees
Labels
status: in triagea maintainer should (re-)triage (review) this issuea maintainer should (re-)triage (review) this issuetype: buga defect, confirmed by a maintainera defect, confirmed by a maintainer