You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/guide/cli.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -225,7 +225,7 @@ You cannot use this option with `--watch` enabled (enabled in dev by default).
225
225
:::
226
226
227
227
::: tip
228
-
If `--reporter=blob` is used without an output file, the default path will include the current shard config to avoid collisions with other Vitest processes.
228
+
If `--reporter=blob` is used without an output file, the default path will include the current shard config and blob label from `VITEST_BLOB_LABEL` or the blob reporter `label` option to avoid collisions with other Vitest processes.
Copy file name to clipboardExpand all lines: docs/guide/improving-performance.md
+12-3Lines changed: 12 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -132,6 +132,12 @@ Collect the results stored in `.vitest-reports` directory from each machine and
132
132
vitest run --merge-reports
133
133
```
134
134
135
+
When running the same shards across multiple environments, set the `VITEST_BLOB_LABEL` environment variable so merged reports can display them separately:
136
+
137
+
```sh
138
+
VITEST_BLOB_LABEL=linux vitest run --reporter=blob --shard=1/3
139
+
```
140
+
135
141
::: details GitHub Actions example
136
142
This setup is also used at https://github.com/vitest-tests/test-sharding.
137
143
@@ -144,9 +150,10 @@ on:
144
150
- main
145
151
jobs:
146
152
tests:
147
-
runs-on: ubuntu-latest
153
+
runs-on: ${{ matrix.os }}
148
154
strategy:
149
155
matrix:
156
+
os: [ubuntu-latest, macos-latest]
150
157
shardIndex: [1, 2, 3, 4]
151
158
shardTotal: [4]
152
159
steps:
@@ -163,12 +170,14 @@ jobs:
163
170
164
171
- name: Run tests
165
172
run: pnpm run test --reporter=blob --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
173
+
env:
174
+
VITEST_BLOB_LABEL: ${{ matrix.os }}
166
175
167
176
- name: Upload blob report to GitHub Actions Artifacts
We recommend using this reporter if you are running Vitest on different machines with the [`--shard`](/guide/cli#shard) flag.
752
-
All blob reports can be merged into any report by using `--merge-reports` command at the end of your CI pipeline:
751
+
We recommend using this reporter if you are running Vitest on different machines with the [`--shard`](/guide/cli#shard) flag or across multiple environments (e.g., linux/macos/windows). All blob reports can be merged into any report by using `--merge-reports` command at the end of your CI pipeline:
When running the same tests across multiple environments, use the `VITEST_BLOB_LABEL` environment variable to distinguish each environment's blob. Vitest reads labels at merge time and displays results separately:
758
+
759
+
```bash
760
+
VITEST_BLOB_LABEL=linux vitest run --reporter=blob
761
+
```
762
+
763
+
You can also provide the label via the blob reporter option. This has higher priority than `VITEST_BLOB_LABEL`.
764
+
765
+
```ts [vitest.config.ts]
766
+
import { defineConfig } from'vitest/config'
767
+
768
+
exportdefaultdefineConfig({
769
+
test: {
770
+
reporters: [
771
+
['blob', { label: 'linux' }],
772
+
],
773
+
},
774
+
})
775
+
```
776
+
758
777
Blob reporter output doesn't include file-based [attachments](/api/advanced/artifacts.html#testattachment).
759
778
Make sure to merge [`attachmentsDir`](/config/attachmentsdir) separately alongside blob reports on CI when using this feature.
<divv-if="isTypecheck"v-tooltip.bottom="'This is a typecheck test. It won\'t report results of the runtime tests'"class="i-logos:typescript-icon"flex-shrink-0 />
0 commit comments