Skip to content

Latest commit

 

History

History
29 lines (18 loc) · 937 Bytes

File metadata and controls

29 lines (18 loc) · 937 Bytes

Minimal Reproducible Example

Issue

vitest fails a shard if the shard index is higher than the number of test files.

For example, let's say there is only a single test file but you instruct vitest to split up the test suite into two shards. While the first shard will pass, the second shard will fail claiming that there are no test files found.

❯ npm run test:shard-2

> test:shard-2
> vitest run --shard=2/2


 RUN  v3.2.1 /Users/niklaas/git/red-guava/mre-vitest-shard-missing-files

No test files found, exiting with code 1

include: **/*.{test,spec}.?(c|m)[jt]s?(x)
exclude:  **/node_modules/**, **/dist/**, **/cypress/**, **/.{idea,git,cache,output,temp}/**, **/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*

Workaround

You can add the --passWithNotTests flag. However, this could cause you to miss out on no tests being executed for the first shard.