-
Notifications
You must be signed in to change notification settings - Fork 30.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test runner does not print Error cause
#44656
Comments
It looks like I'm sure somewhere a conversation has been had about what |
That would be great! Using Side note: we might want to add a linter rule that prevents using |
there is some splitting and parsing done on the stack trace - I assume it is there to make sure the YAML is valid |
@BridgeAR to be clear, is @MoLow looks like just a Something like util.inspect(error).split('\n').slice(1).forEach(line => stream.write(`${indent}${line}\n`)) |
@Qix- the parsing also converts a stack trace from |
Extra error properties would kind of blend in though, was there a specific reason e.g. without any processing (though I manually removed the first line)
vs with trim +
|
Waiting for @cjihrig to answer |
No particular reason. It was more of a stylistic choice. |
@qix waiting for a PR then |
In case leading whitespace is not required: it's possible to define that as an option using |
Haven't forgotten about this - trying to get tests on Looking at the implementation, I'd be stripping away a lot of logic that's there just by switching to Would it be beneficial to instead output a YAML array of Something like... try {
somethingThatThrows();
} catch (error) {
const err = new Error('operation failed', {cause: error});
err.foo = 'BAR';
throw err;
} - message: operation failed
stack:
- ...
- ...
- ...
foo: BAR
- message: internal error
code: INTERNAL_ERROR
stack:
- somethingThatThrows() (...)
- ...
- ... Not sure if that's breaking the TAP protocol at all but handles this case well whilst adding more value to the YAML output, in my opinion. |
This should be fixed once #47867 lands. |
PR-URL: #47867 Fixes: #44656 Fixes: #47955 Fixes: #47481 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
PR-URL: #47867 Fixes: #44656 Fixes: #47955 Fixes: #47481 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
PR-URL: #47867 Fixes: #44656 Fixes: #47955 Fixes: #47481 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
PR-URL: nodejs#47867 Fixes: nodejs#44656 Fixes: nodejs#47955 Fixes: nodejs#47481 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
Version
v18.7.0
Platform
Darwin Joshs-MBP-2 21.6.0 Darwin Kernel Version 21.6.0: Sat Jun 18 17:07:22 PDT 2022; root:xnu-8020.140.41~1/RELEASE_ARM64_T6000 arm64
Subsystem
Test Runner
What steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
Unconditional
What is the expected behavior?
Getting
cause
output such as:What do you see instead?
(partial TAP output)
Additional information
The
cause
parameter is essential in understanding e.g.undici
's (Node.js's "native"fetch()
implementation) error messages as otherwise you just get a crypticfetch failed
error message. This is a huge pain point in trying to adopt the test runner for a new project.The text was updated successfully, but these errors were encountered: