Skip to content

test_runner: preserve AssertionError actual constructor name across isolation#61716

Open
inoway46 wants to merge 2 commits intonodejs:mainfrom
inoway46:fix-50397-regression-first
Open

test_runner: preserve AssertionError actual constructor name across isolation#61716
inoway46 wants to merge 2 commits intonodejs:mainfrom
inoway46:fix-50397-regression-first

Conversation

@inoway46
Copy link

@inoway46 inoway46 commented Feb 7, 2026

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

  1. Added a regression test first

    • test/parallel/test-runner-issue-50397.js
    • test/fixtures/test-runner/issue-50397/prototype-mismatch.js
    • Covers both --test-isolation=none and --test-isolation=process.
  2. Implemented a test-runner-scoped fix

    • Added lib/internal/test_runner/assertion_error_prototype.js to collect/apply metadata for AssertionError actual/expected constructor names.
    • Wired metadata collection in lib/internal/test_runner/reporter/v8-serializer.js.
    • Wired metadata application and cleanup in lib/internal/test_runner/runner.js.
  3. Added focused sequential coverage for the helper logic

    • test/sequential/test-runner-assertion-error-prototype.js
    • Verifies metadata collection, restoration after serialize/deserialize, and idempotent application.

Why this approach

The fix is intentionally scoped to internal/test_runner/* so that shared internal/error_serdes behavior is unchanged for other subsystems.

Tests

  • python3 tools/test.py test/parallel/test-runner-issue-50397.js
  • python3 tools/test.py test/sequential/test-runner-assertion-error-prototype.js
  • python3 tools/test.py test/sequential/test-error-serdes.js

Fixes #50397

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/test_runner

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. test_runner Issues and PRs related to the test runner subsystem. labels Feb 7, 2026
@inoway46 inoway46 force-pushed the fix-50397-regression-first branch 2 times, most recently from d7ee644 to 02d6049 Compare February 7, 2026 11:46
@inoway46 inoway46 marked this pull request as ready for review February 7, 2026 11:53
@inoway46 inoway46 force-pushed the fix-50397-regression-first branch from 02d6049 to e092462 Compare February 7, 2026 14:01
@inoway46 inoway46 force-pushed the fix-50397-regression-first branch from e092462 to 0fee869 Compare February 7, 2026 15:46
@MoLow
Copy link
Member

MoLow commented Feb 8, 2026

@BridgeAR PTAL

@codecov
Copy link

codecov bot commented Feb 8, 2026

Codecov Report

❌ Patch coverage is 81.48148% with 40 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.74%. Comparing base (f6464c5) to head (0fee869).
⚠️ Report is 59 commits behind head on main.

Files with missing lines Patch % Lines
.../internal/test_runner/assertion_error_prototype.js 79.78% 33 Missing and 5 partials ⚠️
lib/internal/test_runner/runner.js 84.61% 1 Missing and 1 partial ⚠️
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     
Files with missing lines Coverage Δ
lib/internal/test_runner/reporter/v8-serializer.js 100.00% <100.00%> (ø)
lib/internal/test_runner/runner.js 92.91% <84.61%> (-0.21%) ⬇️
.../internal/test_runner/assertion_error_prototype.js 79.78% <79.78%> (ø)

... and 59 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ci PRs that need a full CI run. test_runner Issues and PRs related to the test runner subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

deepStrictEqual diff is unhelpful when prototype mismatches

3 participants