-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
Closed
Labels
test_runnerIssues and PRs related to the test runner subsystem.Issues and PRs related to the test runner subsystem.
Description
Version
v20.8.1
Platform
Darwin adonai 22.6.0 Darwin Kernel Version 22.6.0: Fri Sep 15 13:41:28 PDT 2023; root:xnu-8796.141.3.700.8~1/RELEASE_ARM64_T6000 x86_64
Subsystem
No response
What steps will reproduce the bug?
- Save this test to a file, e.g.
issue.mjs
import { describe, before, it } from 'node:test';
describe('Testy test', () => {
before(() => {
throw new Error('This error is not output');
});
it('test', () => {
console.log('test pass');
});
});- Run the test runner in watch mode:
node --test --watch issue.mjs
How often does it reproduce? Is there a required condition?
reproduces every time
What is the expected behavior? Why is that the expected behavior?
I expect to see the error and stacktrace in the output. If you do not run the test in watch mode, the error is not swallowed and the output looks like:
▶ Testy test
✖ test
'test did not finish before its parent and was cancelled'
▶ Testy test (1.376667ms)
ℹ tests 1
ℹ suites 1
ℹ pass 0
ℹ fail 0
ℹ cancelled 1
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 158.914542
✖ failing tests:
test at file:/tmp/issue.mjs:8:5
✖ test
'test did not finish before its parent and was cancelled'
test at file:/tmp/issue.mjs:3:1
✖ Testy test (1.376667ms)
Error: This error is not output
at SuiteContext.<anonymous> (file:///tmp/issue.mjs:5:15)
at TestHook.runInAsyncScope (node:async_hooks:206:9)
at TestHook.run (node:internal/test_runner/test:631:25)
at TestHook.run (node:internal/test_runner/test:856:18)
at TestHook.run (node:internal/util:531:12)
at node:internal/test_runner/test:565:20
at async Suite.runHook (node:internal/test_runner/test:563:7)
at async Suite.run (node:internal/test_runner/test:942:7)
at async startSubtest (node:internal/test_runner/harness:208:3)
What do you see instead?
I get output (notice no exception or stack trace):
▶ Testy test
✖ test
'test did not finish before its parent and was cancelled'
▶ Testy test (1.341125ms)
Additional information
If the Error is thrown in it, describe, beforeEach, or afterEach it does show as expected in output. The problem seems to be confined to before and after blocks.
tonivj5, broofa and louwers
Metadata
Metadata
Assignees
Labels
test_runnerIssues and PRs related to the test runner subsystem.Issues and PRs related to the test runner subsystem.