label experimental 4.1.3+
- Type:
string - CLI:
--label=<label>
Label for the current test run. When set, the label is displayed alongside test results in the reporter output, and stored in the blob when using --reporter=blob.
During --merge-reports, results from the same test files with different labels are kept as separate entries. The label is also included in the default blob output filename (e.g. blob-linux.json) to avoid collisions between runs on different machines.
Example
Run with a label on each platform:
bash
vitest run --reporter=blob --label=linux
vitest run --reporter=blob --label=macosOr set it via config, typically driven by an environment variable in CI:
ts
import { defineConfig } from 'vitest/config'
export default defineConfig({
test: {
label: `${process.platform}-${process.versions.node}`,
reporters: ['blob'],
},
})When merging, each label is displayed as a separate entry in the reporter output:
sh
vitest --merge-reports
✓ linux src/basic.test.ts (2 tests)
✓ macos src/basic.test.ts (2 tests)See Blob Reporter and the CI setup guide for a full example.
