-
Notifications
You must be signed in to change notification settings - Fork 38
Migrate tests to native node:test, remove Babel/Jest tooling, and clarify long-stack-trace behavior #66
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
Merged
Merged
Migrate tests to native node:test, remove Babel/Jest tooling, and clarify long-stack-trace behavior #66
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
bfd14da
test: migrate suites to node:test and assert
niemyjski de7d1a1
chore: drop jest babel and long-stack-traces dependencies
niemyjski 97182e3
ci/docs: keep node 24/25 matrix and clarify long-stack trace support
niemyjski 6e919c5
Potential fix for pull request finding
niemyjski 6cc3732
test: assert user-code frames are compared in parse parity test
niemyjski e5189b0
Potential fix for pull request finding
niemyjski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,3 +1,2 @@ | ||
| __tests__/ | ||
| .babelrc | ||
| .travis.yml | ||
| .github/ |
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,22 +1,36 @@ | ||
| import { describe, it } from 'node:test'; | ||
| import assert from 'node:assert/strict'; | ||
| import { parse } from "../index.js"; | ||
| const _ = require('long-stack-traces'); | ||
|
|
||
| // Previously this test used the unmaintained 'long-stack-traces' package | ||
| // (https://github.com/tlrobinson/long-stack-traces) which monkeypatched | ||
| // async APIs to insert dashed separator lines into Error#stack across event | ||
| // loop boundaries. That package (and its suggested replacement 'longjohn') | ||
| // are both unmaintained and incompatible with modern Node.js ESM. | ||
| // | ||
| // The parser behavior is preserved: parse() detects lines matching /^\s*[-]{4,}$/ | ||
| // and returns a CallSite with getFileName() === the dashed line. This test | ||
| // validates that behavior deterministically using a synthetic stack string. | ||
|
|
||
| describe("long stack trace", () => { | ||
| test("basic", (done) => { | ||
| function badFn() { | ||
| var err = new Error('oh no'); | ||
| var trace = parse(err); | ||
| it("parses event loop boundary markers", () => { | ||
| const err = { | ||
| stack: | ||
| 'Error: oh no\n' + | ||
| ' at badFn (/path/to/file.js:10:5)\n' + | ||
| ' ----------------------------------------\n' + | ||
| ' at setTimeout\n' + | ||
| ' at Object.<anonymous> (/path/to/file.js:20:3)' | ||
| }; | ||
|
|
||
| const trace = parse(err); | ||
|
|
||
| for (var i in trace) { | ||
| var filename = trace[i].getFileName(); | ||
| if (typeof filename === 'string' && filename.match(/-----/)) { | ||
| done(); | ||
| return; | ||
| } | ||
| } | ||
| expect.fail(); | ||
| } | ||
| const boundary = trace.find((site) => { | ||
| const fileName = site.getFileName(); | ||
| return typeof fileName === 'string' && fileName.match(/-----/); | ||
| }); | ||
|
|
||
| setTimeout(badFn, 10); | ||
| assert.notStrictEqual(boundary, undefined); | ||
| assert.match(boundary.getFileName(), /-----/); | ||
|
Comment on lines
+33
to
+34
|
||
| }); | ||
| }); | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.