Skip to content

npm run test <pattern> and --silent option unexpectedly run all tests instead of matching only one file #8046

@mityaua

Description

@mityaua

Describe the bug

Vitest 3.1.4 runs all tests when using npm run test or --silent instead of limiting to the matching file.

After upgrading from [email protected] to [email protected]:

when running a test using a file name as a pattern:

✅ npx vitest success-reset-password-page correctly runs only that test file

❌ npm run test success-reset-password-page runs all tests, even though the pattern is passed

❌ npx vitest --silent success-reset-password-page also runs all tests

Image
Image
Image

This worked correctly in 2.1.8, but is broken in 3.1.4.

Reproduction

"test": "vitest --silent"

"@pinia/testing": "^1.0.1",
"@quasar/quasar-app-extension-testing-unit-vitest": "^1.2.3",
"@vitest/coverage-v8": "^3.1.4",
"@vue/test-utils": "^2.4.6",
"vitest": "^3.1.4",
import { fileURLToPath } from "node:url";
import { mergeConfig, defineConfig, configDefaults } from "vitest/config";
import viteConfig from "./vite.config";

export default mergeConfig(
	viteConfig,
	defineConfig({
		test: {
			globals: true,
			environment: "jsdom",
			exclude: [...configDefaults.exclude, "e2e/*"],
			root: fileURLToPath(new URL("./", import.meta.url)),
			coverage: {
				provider: "v8",
				exclude: [
					...(configDefaults.coverage?.exclude || []),
					"server.js",
					"middleware/**",
					"vue.config.js",
					"src/main.ts",
				],
			},
		},
	})
);

System Info

System:
    OS: Windows 11 10.0.26100
    CPU: (4) x64 Intel(R) Core(TM) i5-4200M CPU @ 2.50GHz
    Memory: 8.27 GB / 15.91 GB
  Binaries:
    Node: 20.18.1 - C:\Program Files\nodejs\node.EXE
    npm: 11.3.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Chromium (131.0.2903.146)
  npmPackages:
    @vitejs/plugin-vue: ^5.2.4 => 5.2.4
    @vitest/coverage-v8: ^3.1.4 => 3.1.4
    vite: ^6.3.5 => 6.3.5
    vitest: ^3.1.4 => 3.1.4

Used Package Manager

npm

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    feat: reportersIssues and PRs related to Vitest reportersp3-minor-bugAn edge case that only affects very specific usage (priority)

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions