Repository navigation
test_runner: add option to forbid exclusive tests - #66578
Open
joao-oliveira-softtor wants to merge 3 commits into
Open
joao-oliveira-softtor wants to merge 3 commits into
joao-oliveira-softtor wants to merge 3 commits into
Conversation
Collaborator
|
Review requested:
|
Contributor
|
Caution AgentScan found account activity patterns that may be consistent with automation. This is a heuristic, not proof that this pull request was opened by an agent or violates policy. AI-assisted contributions are permitted, but automated tooling must not open pull requests without advance approval, and contributors must personally understand, test, verify, and take responsibility for every submitted change. See the AgentScan analysis, AI use policy, and automation policy for additional context. |
joao-oliveira-softtor
added a commit
to joao-oliveira-softtor/node
that referenced
this pull request
Oct 7, 2026
Refs: nodejs#66578 Assisted-by: a coding agent Signed-off-by: João Victor <joao.oliveira@softtor.com.br>
joao-oliveira-softtor
marked this pull request as ready for review
October 8, 2026 02:09
Add --test-forbid-only and the forbidOnly run() option to detect accidentally committed exclusive tests. Reject only declarations and runOnly(true) in both isolation modes, and record a run-level failure so TODO and expected failures cannot absorb the error. Document the runtime-only detection and add regression coverage for filtering, option inheritance, both isolation modes, and disabled guards. Refs: nodejs#60917 Assisted-by: a coding agent Signed-off-by: João Victor <joao.oliveira@softtor.com.br>
Refs: nodejs#66578 Assisted-by: a coding agent Signed-off-by: João Victor <joao.oliveira@softtor.com.br>
joao-oliveira-softtor
force-pushed
the
test-runner-forbid-only
branch
from
October 8, 2026 02:15
543425b to
c42ee6e
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #66578 +/- ##
==========================================
+ Coverage 90.43% 90.46% +0.03%
==========================================
Files 791 791
Lines 276488 276596 +108
Branches 53097 53129 +32
==========================================
+ Hits 250029 250212 +183
+ Misses 16855 16797 -58
+ Partials 9604 9587 -17
🚀 New features to boost your workflow:
|
Skip forbidOnly environment cases when NODE_OPTIONS is disabled at build time. Darwin shared-library CI deliberately uses this setting. Test CLI and NODE_OPTIONS overrides separately so CLI coverage stays active in these builds. Refs: nodejs#66578 Assisted-by: a coding agent Signed-off-by: João Victor <joao.oliveira@softtor.com.br>
cjihrig
approved these changes
Oct 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With test isolation disabled, an accidentally committed
test.only()cansilently exclude the rest of a test suite while the run still succeeds.
Add
--test-forbid-onlyandrun({ forbidOnly: true })to reject exclusivetests in CI. The guard covers
only: true, the test and suite.only()shorthands, and
testContext.runOnly(true), in both isolation modes.Detected violations fail the run even when a surrounding test is TODO or
expects failure. Only declarations actually evaluated during the run can
be checked.
The option is disabled by default. An explicit
forbidOnly: falseoverridesan inherited command-line or
NODE_OPTIONSsetting.This is a proposed API for the rejection behavior discussed in #60917;
the existing boolean
--test-onlyoption is unchanged.Validation
CLI options, and configuration files. 86 passed initially; the reporters
test passed when rerun without the environment's
NO_COLOR, whichconflicted with the test's
FORCE_COLORsetting.manual page.
the run incorrectly succeeded.
Full repository and cross-platform CI have not been run locally.
AI assistance
Codex assisted with implementation, test authoring, source review, and the
local automated checks described above. This draft is being opened by
the coding agent at the contributor's explicit request. These checks do
not represent personal verification by the contributor.
Refs: #60917