fix(test): pass --passWithNoTests to vitest#1240
Open
John-David Dalton (jdalton) wants to merge 1 commit intomainfrom
Open
fix(test): pass --passWithNoTests to vitest#1240John-David Dalton (jdalton) wants to merge 1 commit intomainfrom
John-David Dalton (jdalton) wants to merge 1 commit intomainfrom
Conversation
When a scoped test run (e.g. pre-commit hook with --staged, or an edit that doesn't touch testable code) produces glob/arg patterns that match no test files, vitest exits 1 with "No test files found". That's a false positive — a scope producing zero matches should succeed, not block a commit. Add --passWithNoTests so the exit code reflects test outcomes, not whether the patterns happened to match files.
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.
Summary
Context
This is part of a cross-repo consistency pass — the same fix has been applied to socket-btm, socket-lib, socket-registry, socket-sdxgen, socket-packageurl-js, socket-tui, and socket-repo-template. socket-sdk-js has its own PR: SocketDev/socket-sdk-js#598
Test plan
Note
Low Risk
Low risk: only changes the Vitest invocation flag so scoped runs with zero matched tests exit successfully; no production code paths are affected.
Overview
Updates the CLI
test-wrapper.mtsto always run Vitest with--passWithNoTests, so scoped/globbed test runs that match no files no longer fail with a non-zero exit code.Adds a short inline comment explaining the pre-commit/scoped-run motivation.
Reviewed by Cursor Bugbot for commit 5748ddf. Configure here.