-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: show all cause in Error (#5422)
* feat: show all cause in Error * test: sample to test stderr cause * Add indentation --------- Co-authored-by: Lukas Taegert-Atkinson <lukastaegert@users.noreply.github.com> Co-authored-by: Lukas Taegert-Atkinson <lukas.taegert-atkinson@tngtech.com>
- Loading branch information
1 parent
8521d29
commit 5301dec
Showing
4 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
const { assertIncludes } = require('../../../utils.js'); | ||
|
||
module.exports = defineTest({ | ||
description: 'prints error cause', | ||
command: 'rollup --config rollup.config.mjs', | ||
// We expect an error and want to make assertions about the output | ||
error: () => true, | ||
stderr: stderr => { | ||
// We just assert the parts of the output that do not change | ||
assertIncludes(stderr, '\n[!] (plugin at position 1) Error: Outer error\n at '); | ||
assertIncludes(stderr, '\n [cause] Error: Inner error\n at '); | ||
assertIncludes(stderr, '\n [cause] Error: Innermost error\n at '); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
assert.ok(true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
export default { | ||
input: "main.js", | ||
plugins: [ | ||
{ | ||
buildStart() { | ||
throw new Error("Outer error", { | ||
cause: new Error("Inner error", { | ||
cause: new Error("Innermost error") | ||
}) | ||
}); | ||
} | ||
} | ||
] | ||
}; |