Skip to content

test_runner: scope rerun ids to the entry file - #67512

Closed
MoLow wants to merge 2 commits into
nodejs:mainfrom
MoLow:test_runner-rerun-shared-helper
Closed

MoLow wants to merge 2 commits into
nodejs:mainfrom
MoLow:test_runner-rerun-shared-helper

Conversation

@MoLow

@MoLow MoLow commented Nov 16, 2026

Copy link
Copy Markdown
Member

With process isolation, the --test-rerun-failures state file is
written by the parent process, which numbered tests sharing a location
across all test files, while each child process numbers them within
its own file. A test defined in a helper used by several test files
was therefore looked up in a slot belonging to another file, and a
failing test could be replayed as passed without running.

Prefix the identifier of a test defined outside of its entry file with
the entry file when tests run in per-file child processes, and build
the identifier with the same helper on both sides.

The location of a test file run in a child process was resolved
against `process.cwd()`, so `run()` reported a wrong `entryFile` for
relative paths when called with a different `cwd`.

Signed-off-by: Moshe Atlow <moshe@atlow.co.il>
With process isolation, the `--test-rerun-failures` state file is
written by the parent process, which numbered tests sharing a location
across all test files, while each child process numbers them within
its own file. A test defined in a helper used by several test files
was therefore looked up in a slot belonging to another file, and a
failing test could be replayed as passed without running.

Prefix the identifier of a test defined outside of its entry file with
the entry file when tests run in per-file child processes, and build
the identifier with the same helper on both sides.

Signed-off-by: Moshe Atlow <moshe@atlow.co.il>
@MoLow MoLow added the commit-queue-rebase PRs the Commit Queue should land as multiple self-contained commits. label Nov 16, 2026
@nodejs-github-bot

Copy link
Copy Markdown
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 Nov 16, 2026
@MoLow MoLow added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 16, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 16, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@codecov

codecov Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.66%. Comparing base (ab476ec) to head (2873943).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #67512      +/-   ##
==========================================
- Coverage   90.68%   90.66%   -0.03%     
==========================================
  Files         799      799              
  Lines      280246   280260      +14     
  Branches    54113    54121       +8     
==========================================
- Hits       254150   254090      -60     
- Misses      16234    16284      +50     
- Partials     9862     9886      +24     
Files with missing lines Coverage Δ
lib/internal/test_runner/harness.js 87.47% <100.00%> (+0.14%) ⬆️
lib/internal/test_runner/reporter/rerun.js 93.40% <100.00%> (ø)
lib/internal/test_runner/runner.js 95.18% <100.00%> (ø)
lib/internal/test_runner/test.js 97.99% <100.00%> (ø)
lib/internal/test_runner/utils.js 66.88% <100.00%> (+0.48%) ⬆️

... and 33 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.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@atlowChemi atlowChemi added author ready PRs with CI started, the required approvals, and no outstanding review comments. commit-queue PRs queued for automated landing through the Commit Queue. labels Nov 16, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Landed in d78268e...20a93ab

nodejs-github-bot pushed a commit that referenced this pull request Nov 18, 2026
The location of a test file run in a child process was resolved
against `process.cwd()`, so `run()` reported a wrong `entryFile` for
relative paths when called with a different `cwd`.

Signed-off-by: Moshe Atlow <moshe@atlow.co.il>
PR-URL: #67512
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
nodejs-github-bot pushed a commit that referenced this pull request Nov 18, 2026
With process isolation, the `--test-rerun-failures` state file is
written by the parent process, which numbered tests sharing a location
across all test files, while each child process numbers them within
its own file. A test defined in a helper used by several test files
was therefore looked up in a slot belonging to another file, and a
failing test could be replayed as passed without running.

Prefix the identifier of a test defined outside of its entry file with
the entry file when tests run in per-file child processes, and build
the identifier with the same helper on both sides.

Signed-off-by: Moshe Atlow <moshe@atlow.co.il>
PR-URL: #67512
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
@nodejs-github-bot nodejs-github-bot removed the commit-queue PRs queued for automated landing through the Commit Queue. label Nov 18, 2026
aduh95 pushed a commit that referenced this pull request Nov 19, 2026
The location of a test file run in a child process was resolved
against `process.cwd()`, so `run()` reported a wrong `entryFile` for
relative paths when called with a different `cwd`.

Signed-off-by: Moshe Atlow <moshe@atlow.co.il>
PR-URL: #67512
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
aduh95 pushed a commit that referenced this pull request Nov 19, 2026
With process isolation, the `--test-rerun-failures` state file is
written by the parent process, which numbered tests sharing a location
across all test files, while each child process numbers them within
its own file. A test defined in a helper used by several test files
was therefore looked up in a slot belonging to another file, and a
failing test could be replayed as passed without running.

Prefix the identifier of a test defined outside of its entry file with
the entry file when tests run in per-file child processes, and build
the identifier with the same helper on both sides.

Signed-off-by: Moshe Atlow <moshe@atlow.co.il>
PR-URL: #67512
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. commit-queue-rebase PRs the Commit Queue should land as multiple self-contained commits. 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.

4 participants