test: run AbstractMethodError and parseJson unit tests under Bun#21273
Conversation
Both unit tests asserted V8-specific error text and were guarded off on Bun (JSC) via an isV8 flag. Assert webpack's own contract instead: the message shape and folded-in caller name for AbstractMethodError, and the name/systemError/position/"while parsing …" context for parseJson. Move the token→hex and position-extraction coverage into direct JSONParseError tests fed synthetic V8-shaped messages so it runs identically on every engine.
|
|
This PR is packaged and the instant preview is available (03a0433). Install it locally:
npm i -D webpack@https://pkg.pr.new/webpack@03a0433
yarn add -D webpack@https://pkg.pr.new/webpack@03a0433
pnpm add -D webpack@https://pkg.pr.new/webpack@03a0433 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #21273 +/- ##
==========================================
+ Coverage 92.81% 92.85% +0.03%
==========================================
Files 592 592
Lines 64964 65024 +60
Branches 18135 18163 +28
==========================================
+ Hits 60299 60379 +80
+ Misses 4665 4645 -20
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Escape BOM bytes as \uFEFF and apply Prettier formatting.
The folded caller name relies on V8 stack format; assert it only on V8 and keep the message-shape assertion on every engine.
c33c518 to
6bb5333
Compare
Deno's V8 stack frames differ from Node's, so the folded caller name in the message can't be matched there; restrict the exact assertion to Node.
Types CoverageCoverage after merging test/unskip-bun-unit-tests into main will be
Coverage Report
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Summary
The
AbstractMethodError.unittest.jsandparseJson.unittest.jssuites were skipped under Bun even though the underlying behavior works there; this rewrites their runtime-specific assertions (error-stack formatting and JSON parse error messages) to be runtime-agnostic so they run under Bun too, closing more of the gap toward a fully passing Bun test run.What kind of change does this PR introduce?
test
Did you add tests for your changes?
n/a — this changes existing unit tests (
test/AbstractMethodError.unittest.js,test/parseJson.unittest.js) to run under Bun rather than adding new ones.Does this PR introduce a breaking change?
No.
If relevant, what needs to be documented once your changes are merged or what have you already documented?
n/a
Use of AI
AI (Claude Code) was used to identify the runtime-specific assertions and rewrite them to be runtime-agnostic; all changes were reviewed by me.
Generated by Claude Code