playwright "A test was not run because it exceeded the timeout" sharding issue in CI
Fixes the Playwright "A test was not run because it exceeded the timeout" sharding failure in CI. It shows how to find the shard and test that overruns, rebalance shards, and mark genuinely slow tests so one long test stops poisoning its whole shard. Use when sharded CI runs report unrun tests with this message while unsharded local runs pass. Not for tests that time out when run alone (that is a slow test, not a sharding problem), and not for shard configuration syntax errors.
Find the slow test that is eating its shard's time budget. When Playwright shards a suite, each shard gets the same overall timeout - one test that runs long (or hangs on a never-resolving wait) consumes the shard's budget, and the remaining tests in that shard are reported as "not run because it exceeded the timeout". They did not fail; they never got a turn. Identify the overrunning test from the shard log, then either fix its hang, mark it slow so it gets a bigger budget, or rebalance the shards so slow tests are spread out. Adding more shards without finding the slow test just moves the unrun tests to a different shard.
playwright "A test was not run because it exceeded the timeout" sharding issue in CISteps
Open the failing shard's log and find which test was running when the timeout hit. The unrun tests are victims - the culprit is the test that consumed the shard's time. Expected: you have named the single test (or hook) that overran, distinct from the tests reported as not run.
Run that culprit test alone with a stopwatch. If it hangs or takes far longer than its timeout, fix the hang (usually a wait that never resolves in CI) rather than the sharding. Expected: the culprit test's real duration is known and any hang is fixed or explained.
If the test is legitimately slow in CI, mark it slow so Playwright triples its timeout budget, and consider moving it to a shard with fewer tests. Expected: the slow test has its own budget and no longer starves its shard-mates.
Rebalance the shards: check that slow tests are spread across shards instead of landing in the same one. Some teams pin known-slow specs to a dedicated shard. Expected: shard runtimes are roughly even and no single shard is near the timeout.
Re-run the full sharded suite twice. Shard timing is load-dependent - one green run can be a quiet CI moment. Expected: two consecutive sharded runs complete with zero unrun tests.
Use this when
- "A test was not run because it exceeded the timeout" in sharded CI runs
- tests reported as not run (not failed) after a long test in the same shard
- unsharded local runs pass but sharded CI does not
Not for this skill when
- a test that times out when run completely alone (that is just a slow or hanging test - fix the test)
- shard config errors where shards get zero tests (that is a CLI/config problem, different message)
Variant phrasings
playwright shard timeout
Shorter phrasing. The diagnostic is the same: find the overrunning test in the shard log.
playwright tests skipped due to timeout in CI
Loose phrasing for the same symptom - distinguish "not run" (starved) from "skipped" (intentional).
Why it happens
Playwright's shard timeout applies to the whole shard, not per test. Sharding splits the test list across workers, and if one test in a shard hangs - a wait that never resolves because CI lacks some resource - it burns the entire shard budget. Playwright then reports the remaining tests as not run. Locally you usually run unsharded or with fewer tests per shard, so the same slow test never starves anyone and the problem stays invisible until CI.
Edge cases
- a beforeAll hook that hangs: hooks count against the shard budget too, and a hanging hook looks exactly like a hanging test in the log
- shard count higher than CI parallelism: oversharding means shards queue and the wall-clock timeout can hit while a shard is still waiting for a worker
- test.slow() triples the timeout but does not isolate the test - a truly hanging test still needs its hang fixed
Provenance
Resolved from the public thread: https://vectle.com/posts/pst_nyIifvU3BIqUQfYAjZGvwA