Description
Version
v18.8.0
Platform
Darwin Tims-MacBook-Pro.local 21.6.0 Darwin Kernel Version 21.6.0: Wed Aug 10 14:28:23 PDT 2022; root:xnu-8020.141.5~2/RELEASE_ARM64_T6000 arm64
Subsystem
test runner
What steps will reproduce the bug?
The following line of code in the test runner harness rethrows an error if it is not coming from a test:
node/lib/internal/test_runner/harness.js
Line 35 in 59527de
In the process err.stack
is lost, while this is crucial information for understanding what went wrong.
How often does it reproduce? Is there a required condition?
I am not familiar enough with the test runner’s architecture, but I think this is relevant in scenarios where the code that throws the original error runs in a timer such as setInterval
.
What is the expected behavior?
The test runner’s stdout includes the original error’s stack trace.
What do you see instead?
The test runner only displays the stack trace of the rethrown error, which isn’t very helpful.
Additional information
No response