From c00983c5a23497e92936535938b353cf0a7cf1af Mon Sep 17 00:00:00 2001 From: Artem Zakharchenko Date: Mon, 2 Jun 2025 19:19:55 +0200 Subject: [PATCH] docs(performance): clarify the way sharding works (#8072) --- docs/guide/improving-performance.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/guide/improving-performance.md b/docs/guide/improving-performance.md index b43680370..e9ed9a8bf 100644 --- a/docs/guide/improving-performance.md +++ b/docs/guide/improving-performance.md @@ -75,7 +75,7 @@ export default defineConfig({ ## Sharding -Test sharding means running a small subset of test cases at a time. It can be useful when you have multiple machines that could be used to run tests simultaneously. +Test sharding is a process of splitting your test suite into groups, or shards. This can be useful when you have a large test suite and multiple matchines that could run subsets of that suite simultaneously. To split Vitest tests on multiple different runs, use [`--shard`](/guide/cli#shard) option with [`--reporter=blob`](/guide/reporters#blob-reporter) option: @@ -85,6 +85,8 @@ vitest run --reporter=blob --shard=2/3 # 2nd machine vitest run --reporter=blob --shard=3/3 # 3rd machine ``` +> Vitest splits your _test files_, not your test cases, into shards. If you've got 1000 test files, the `--shard=1/4` option will run 250 test files, no matter how many test cases individual files have. + Collect the results stored in `.vitest-reports` directory from each machine and merge them with [`--merge-reports`](/guide/cli#merge-reports) option: ```sh -- 2.51.2