feat(test-runner): fail test runs with zero executed tests - #3163
Open
SisyphusZheng wants to merge 1 commit into
Open
SisyphusZheng wants to merge 1 commit into
SisyphusZheng wants to merge 1 commit into
Conversation
A test run now fails when all test files loaded but none of them registered or executed any tests. Previously such a run exited with code 0, silently passing on misconfigured files patterns or emptied test files. Add the passWithNoTests option (config) and --pass-with-no-tests CLI flag to restore the old behavior. Skipped tests count as executed, so a run with only skipped tests still passes. Watch mode and manual mode are unaffected. The default reporter prints an explanation when a run fails with zero executed tests.
🦋 Changeset detectedLatest commit: f62a204 The changes in this PR will be included in the next version bump. This PR includes changesets to release 12 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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.
Problem
A run whose test files all load cleanly but execute zero tests exits
0today. A glob that matches no files already errors out, so this is the last silent-pass path: a misconfiguredfilespattern that still matches one stray file, or a test file whose suites end up empty, reports success with nothing tested. Jest and Vitest both fail in this situation by default (Vitest'spassWithNoTestsdefaults tofalse).Change
1) when all sessions loaded but zero tests were executed; skipped tests count as executed.passWithNoTestsoption (config +--pass-with-no-tests) restores the old behavior.Verification
test-runner-core: zero-executed → fail;passWithNoTests→ pass; skipped-only → pass.dist/bin.js: zero-executed file → exit1with the new message; single test → exit0;--pass-with-no-testsand configpassWithNoTests: true→ exit0; glob matching no files keeps the existing error.test-runner-coreandtest-runnersuites green; unrelated browser-env failures reproduce identically on clean master.Notes