Closed as not planned
Description
🚀 Feature Proposal
Some new APIs like fetch
make use of Error.prototype.cause
which jest does not display at all for thrown errors, which makes debugging these errors harder than necessary.
Motivation
It will make errors with cause
easier to debug.
Example
test("cause", () => {
try {
throw new Error("cause");
} catch (err) {
throw new Error("wrapped", {cause: err});
}
});
Will output only the wrapped error message, which is often unhelpful:
FAIL ./test.js
● cause
wrapped
It'd be better if the cause
message would also be shown:
FAIL ./test.js
● cause
wrapped
cause
Pitch
Because Error.prototype.cause
is a standard Javascript feature.