Repository navigation
test_runner: add option to forbid exclusive tests - #66578
nodejs-github-bot merged 3 commits into
Conversation
|
Review requested:
|
|
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. |
Refs: nodejs#66578 Assisted-by: a coding agent Signed-off-by: João Victor <joao.oliveira@softtor.com.br>
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>
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>
|
Landed in 45b6626 |
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: #60917 Assisted-by: a coding agent Signed-off-by: João Victor <joao.oliveira@softtor.com.br> PR-URL: #66578 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
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> PR-URL: nodejs#66578 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
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