vitest-dev/vitest · error · Error
No projects were found. Make sure your configuration is…
Error message
No projects were found. Make sure your configuration is correct. ${globalConfig.project.length ? `The filter matched no projects: ${globalConfig.project.join(', ')}. ` : ''}The projects definition: ${JSON.stringify(definitions.map(...), null, 4)}. What it means
After expanding browser instances, benchmarks, and applying the --project filter, if every candidate project is hidden/filtered out and projects were declared, Vitest throws. The message includes the active --project filters and a JSON summary of the projects definition so the user can see what was tried. Skipped for the runtime inject path where filtering is expected.
Solutions
- Run without --project to list available project names, then use the exact name.
- Check for typos or stale names in your --project filter / scripts.
- Ensure your projects definition actually yields the names you expect (see the JSON in the error).
- If filtering programmatically, validate names against the declared set first.
Example fix
// before vitest --project=unit-tests // no such project // after - use the real name shown by 'vitest list' vitest --project=unit
Defensive patterns
Strategy: validation
Validate before calling
// Validate --project filters against declared names before running.
function assertFilterMatches(declared: string[], filter: string[]) {
const missing = filter.filter(f => !declared.includes(f))
if (missing.length) throw new Error(`--project filter matched nothing: ${missing.join(', ')}. Available: ${declared.join(', ')}`)
} Type guard
const filterIsSubset = (declared: string[], filter: string[]): boolean => filter.every(f => declared.includes(f))
Prevention
- Run 'vitest list' to discover valid project names before filtering.
- Keep CI filter scripts in sync with project names after refactors.
- Fail fast in scripts if a filter name is unknown.
When it happens
Trigger: User declares 'projects' (or a workspace file) but the --project CLI filter (globalConfig.project) excludes all of them, leaving no runnable project and throwIfEmpty is true.
Common situations: Passing --project with a name that matches none of the declared projects, a typo in the filter, renamed projects, or filters that became stale after refactoring.
Related errors
- VITEST_INCLUDE_TASK_LOCATION_DISABLED
- "browser.instances" was set in the config, but the array is…
- --cache.dir is deprecated
- Failed to initialize projects. There were errors during…
- Found a circular "projects" definition
AI-assisted analysis of vitest-dev/vitest@1fa9837ec2 (2026-08-11).
Data as JSON: /api/errors/658a306450b9aad7.
Report an issue: GitHub.
Appendix: source
Thrown at packages/vitest/src/node/projects/resolveProjects.ts:202
const seenNamesSet = new Set(seenNames.keys())
// Browser instance expansion (per-entry config injection).
const afterBrowser = expandBrowserInstancesInEntries(globalConfig, baseEntries, seenNamesSet)
// Benchmark expansion (per-entry config injection, runs over post-browser list).
// `--benchmark` makes every project run as a benchmark.
const afterBenchmark = expandBenchmarksInEntries(afterBrowser, seenNamesSet, !!globalConfig.cliOptions.benchmarkOnly)
// --project filter (applied after expansion so all candidate names are known).
const filtered = applyProjectFilter(globalConfig, afterBenchmark)
// If the user declared `projects` (or workspace files) but the filter
// excluded every candidate, throw with the projects definition included so
// callers see what was tried. Skipped for the runtime `injectTestProjects`
// path where filtering injected projects out is expected.
const filterMatched = filtered.some(entry => !entry.hidden)
if (throwIfEmpty && definitions && !filterMatched) {
throw new Error(
[
'No projects were found. Make sure your configuration is correct. ',
globalConfig.project.length ? `The filter matched no projects: ${globalConfig.project.join(', ')}. ` : '',
`The projects definition: ${JSON.stringify(
definitions.map((p, index) => typeof p === 'string'
? p
: p instanceof Promise
? 'Promise'
: typeof p === 'function'
? p.name
: ({ name: p.test?.name ?? index })),
null,
4,
)}.`,
].join(''),
)
}
View on GitHub (pinned to 1fa9837ec2)