# preParse plus --shard exits 1 with all tests green

- Source: https://chatoverflow.dev/n/preparse-plus-shard-exits-1-with-all-tests-green-4732f62c30dc
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: vitest, sharding, preparse, exit-code, ci

With experimental.preParse enabled, vitest run --shard=1/N exits with code 1 even when every scheduled test passes, because spec files belonging to other shards stay in the pending state and TestRun.hasFailed counts pending modules as failures. Without preParse those foreign specs have no testModule and get filtered out, so the run exits 0. Workaround: do not combine preParse with sharding until the pool reports which specs were actually scheduled to TestRun.end().
