test_runner: preserve AssertionError actual constructor name across isolation#61716
test_runner: preserve AssertionError actual constructor name across isolation#61716inoway46 wants to merge 1 commit intonodejs:mainfrom
Conversation
|
Review requested:
|
d7ee644 to
02d6049
Compare
e092462 to
0fee869
Compare
|
@BridgeAR PTAL |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #61716 +/- ##
==========================================
- Coverage 89.76% 89.74% -0.03%
==========================================
Files 673 676 +3
Lines 203944 204718 +774
Branches 39191 39352 +161
==========================================
+ Hits 183080 183720 +640
- Misses 13194 13272 +78
- Partials 7670 7726 +56
🚀 New features to boost your workflow:
|
This comment was marked as outdated.
This comment was marked as outdated.
0fee869 to
0505a19
Compare
|
Sharing this investigation in case it helps review context. I did a deeper investigation to clarify why output differs across the three cases described in the original issue comment: I used a one-off custom reporter (not committed) to inspect the parent-side Commands used# Case 1 (node --test + node:test) with payload inspection
./out/Release/node --test --test-isolation=process --test-reporter=./tmp/debug-reporter.mjs ./tmp/repro-50397.mjs
./out/Release/node --test --test-isolation=none --test-reporter=./tmp/debug-reporter.mjs ./tmp/repro-50397.mjs
# Case 2 (node --test without node:test) with payload inspection
./out/Release/node --test --test-isolation=process --test-reporter=./tmp/debug-reporter.mjs ./tmp/repro-50397-no-node-test.mjsUser-facing output commands (by case)# Case 2-A: node --test (without node:test), process isolation
./out/Release/node --test --test-isolation=process ./tmp/repro-50397-no-node-test.mjs
# Case 2-B: plain node (without node:test), non-test-runner reference
./out/Release/node ./tmp/repro-50397-no-node-test.mjs
# Case 3: plain node + node:test (single-process node:test path)
./out/Release/node ./tmp/repro-50397-with-node-test.mjsKey observed payload values
Observed behavior by caseCase 1 (
|
Summary
This PR fixes the regression described in #50397 where test runner output can lose the original constructor name for AssertionError values (for example, ExtendedArray being shown as plain Array in actual output).
What changed
Added a regression test first
test/parallel/test-runner-issue-50397.jstest/fixtures/test-runner/issue-50397/prototype-mismatch.js--test-isolation=noneand--test-isolation=process.Implemented a test-runner-scoped fix
lib/internal/test_runner/assertion_error_prototype.jsto collect/apply metadata for AssertionErroractual/expectedconstructor names.lib/internal/test_runner/reporter/v8-serializer.js.lib/internal/test_runner/runner.js.Added focused sequential coverage for the helper logic
test/sequential/test-runner-assertion-error-prototype.jsWhy this approach
The fix is intentionally scoped to
internal/test_runner/*so that sharedinternal/error_serdesbehavior is unchanged for other subsystems.Tests
python3 tools/test.py test/parallel/test-runner-issue-50397.jspython3 tools/test.py test/sequential/test-runner-assertion-error-prototype.jspython3 tools/test.py test/sequential/test-error-serdes.jsFixes #50397