Skip to content

Fail the test run when a test fails - #185

Merged
arifBurakDemiray merged 1 commit into
stagingfrom
test-exit-code
Nov 17, 2026
Merged

arifBurakDemiray merged 1 commit into
stagingfrom
test-exit-code

Conversation

@turtledreams

Copy link
Copy Markdown
Contributor

npm test ran mocha with --allow-uncaught. That option turns a failing test into an uncaught error, and after an asynchronous hook (most suites clear storage in beforeEach) mocha then stopped: no failure was reported, the remaining test files did not run, and the exit code was 0, so CI passed.

  • The test script no longer passes --allow-uncaught (before: mocha --timeout 180000 test/tests_*.js --exit --allow-uncaught, after: the same without the option). No test relies on it; the full suite passes the same way without it.
  • A new test in test/tests_package.js runs mocha with the options of the test script on a small suite that has an asynchronous hook and one failing test, and checks that the run reports the failure and exits with code 1. It fails with the old script.

npm run coverage passes locally (243 tests).

The test script ran mocha with --allow-uncaught, which turns a failing
test into an uncaught error. After an asynchronous hook, mocha then
stopped without reporting the failure or running the remaining tests,
and exited with code 0, so CI passed.
@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

CI report

Check Result Summary
CodeQL ✅ passed
Node.js CI ✅ passed
Public API changelog ✅ passed
Public API changes ✅ passed Public API: No public API change
Public API changes: Public API, No public API change

No public API change.

For a0c9b61, updated 2026-11-16 08:18 UTC. Each check's run page has its full log.

@arifBurakDemiray
arifBurakDemiray merged commit 5122d2f into staging Nov 17, 2026
21 checks passed
@arifBurakDemiray
arifBurakDemiray deleted the test-exit-code branch November 17, 2026 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants