Replies: 1 comment
-
|
well there’s no flag for this right now. The error happens before Vitest even gets to the “no tests” logic. sharding fails early if the shard count is larger than the number of resolved test files. So We’ve hit the same thing in a monorepo. The only real workaround today is to handle it outside Vitest, e.g.:
It’s a bit annoying, but doing it in the CI matrix is usually the least painful option. What you’re describing (allowing empty shards or a So yeah; I don’t think you’re missing anything. This is probably worth a feature request. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm running with sharding in a package that has less tests than shards. We have a mono repo that have multiple packages and we want to use sharding with the same configuration across all of them. But some of our packages are very small and don't reach the amount of shards.
For example, if I run with
--shard 2/2in a package with a single test, I get the errorError: --shard <count> must be a smaller than count of test files. Resolved 1 test files for --shard=2/2..I actually don't care that the second shard is empty if the first one isn't. I know there is a
--passWithNoTestsflag to not fail if not tests are there, but this seems to be evaluated globally and not per shard. Is there something similar flag for sharding?Beta Was this translation helpful? Give feedback.
All reactions