Skip to content

Commit

Permalink
Prevent outputting Node.js internal error stack frames.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaydenseric committed Nov 2, 2021
1 parent 525717e commit b743da5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- Replaced the package `prepare` script with a `jsdoc` script.
- Added a package `test:jsdoc` script that checks the readme API docs are up to date with the source JSDoc.
- Also run GitHub Actions CI with Node.js v17.
- Prevent outputting the Node.js internal `async Promise.all (index 0)` error stack frame generated by recent Node.js versions that [`stack-utils`](https://npm.im/stack-utils) fails to clean, (see [tapjs/stack-utils#63](https://github.com/tapjs/stack-utils/issues/63)).
- Readme tweaks.

## 6.0.0
Expand Down
6 changes: 5 additions & 1 deletion index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,11 @@ export default class TestDirector {
: error.stack
)
// Remove leading or trailing newlines.
.trim();
.trim()
// Remove an internal Node.js frame generated by recent Node.js
// versions that stack-utils fails to clean, see:
// https://github.com/tapjs/stack-utils/issues/63
.replace(/(?:\r\n?|\n)async Promise\.all \(index 0\)$/u, '');

// Sometimes nothing remains of the stack after cleaning, e.g. for
// filesystem errors that have an identical error message and stack.
Expand Down

0 comments on commit b743da5

Please sign in to comment.