Vitest "Workspace config file not found" in CI
Vitest was told to run in workspace mode but could not locate the workspace definition file. In CI this is almost always a wrong working directory or an uncommitted config.
What this error means
Vitest exits immediately complaining the workspace config was not found. The command works locally from the repo root but fails in the job because of a different cwd.
Error: Workspace config file "vitest.workspace.ts" was not found
in "/work/repo/packages/app".Common causes
Wrong working directory
The job ran vitest from a package subdirectory, so the repo-root workspace file was out of reach.
The workspace file was not committed
vitest.workspace.ts is gitignored or untracked, so the clean CI checkout has no file to load.
How to fix it
Run from the repo root or pass an explicit path
Invoke Vitest where the workspace file lives, or point --workspace at its absolute path.
# run from repo root
vitest run
# or be explicit
vitest run --workspace ./vitest.workspace.tsCommit the workspace definition
Ensure the workspace file is tracked so CI checks it out.
- Confirm git status does not list vitest.workspace.* as untracked.
- Remove any .gitignore rule that hides it.
- Commit the file and re-run CI.
How to prevent it
- Keep the workspace file at the repo root and tracked in git.
- Set the CI working-directory to the repo root for test jobs.
- Verify a clean checkout finds the workspace file before merging.