node
node copied to clipboard
errors thrown in describe() do not set non-zero exitCode (and do not fail CI)
Version
v24.2.0
Platform
Darwin macbook-air.taile5a6b.ts.net 24.4.0 Darwin Kernel Version 24.4.0: Fri Apr 11 18:34:14 PDT 2025; root:xnu-11417.101.15~117/RELEASE_ARM64_T8122 arm64
Subsystem
test
What steps will reproduce the bug?
import { describe, test } from 'node:test'
import assert from 'node:assert/strict'
describe('green', () => {
test('one', () => {
assert(1 === 1)
})
})
describe('red', () => {
test_('one', () => {
assert(1 === 1)
})
test('two', () => {
assert(1 === 2)
})
})
node --test foo.js; echo $?
How often does it reproduce? Is there a required condition?
Every time
What is the expected behavior? Why is that the expected behavior?
A test failure printed and a non-zero exit code upon test termination
What do you see instead?
A test failure printed but the exit code is zero, the test is effectively treated as passing by tooling / CI
Additional information
A work-around using a custom reporter is possible, see https://github.com/ExodusMovement/test/commit/749370166fe70e51dd60e1c11a012cc64a0b15eb