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
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

2 participants