feat(experimental): support merge reports for non-sharded multi-environment runs (take 2)#10031
Open
hi-ogawa wants to merge 51 commits intovitest-dev:mainfrom
Open
feat(experimental): support merge reports for non-sharded multi-environment runs (take 2)#10031hi-ogawa wants to merge 51 commits intovitest-dev:mainfrom
hi-ogawa wants to merge 51 commits intovitest-dev:mainfrom
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
✅ Deploy Preview for vitest-dev ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds a first-class test.label concept to disambiguate identical test files across multiple environment runs (e.g. OS/Node matrix) so blob reports can be merged without collisions, and makes reporters/UI surface that label consistently.
Changes:
- Introduces
test.labelconfig +--labelCLI option, propagating it into serialized config andTaskMeta. - Salts file IDs with
{ typecheck, label }viagenerateFileHash/createFileTask, and updates state deduplication to treat(filepath, projectName, meta.typecheck, meta.label)as the identity. - Updates blob reporter default filenames, default/summary reporters, UI, docs, tests, and CI workflow to generate/merge labeled blob reports.
Reviewed changes
Copilot reviewed 37 out of 37 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
test/test-utils/index.ts |
Extends error tree helpers to optionally key modules by label for merge-report assertions. |
test/core/vite.config.ts |
Emits blob reports in CI when a label env var is set and passes test.label. |
test/cli/vitest.config.ts |
Emits blob reports in CI when a label env var is set and passes test.label. |
test/cli/test/test-specifications.test.ts |
Updates parametrized test API usage and expected stable IDs. |
test/cli/test/reporters/merge-reports.test.ts |
Adds merge-reports coverage for labeled runs (and projects+labels). |
test/cli/test/reporters/__snapshots__/html.test.ts.snap |
Updates snapshot to new hashed task IDs. |
test/cli/test/reported-tasks.test.ts |
Updates expectations for new hashed test specification IDs. |
packages/ws-client/src/state.ts |
Aligns file deduplication key with (projectName, typecheck, label) for WS client state. |
packages/vitest/src/types/global.ts |
Adds label?: string to TaskMeta typing. |
packages/vitest/src/typecheck/collect.ts |
Uses createFileTask to unify ID/meta generation for typecheck collection. |
packages/vitest/src/runtime/config.ts |
Adds label to serialized runtime config shape. |
packages/vitest/src/node/types/config.ts |
Adds label to InlineConfig and resolved config typing. |
packages/vitest/src/node/test-specification.ts |
Allows hashing specs with { typecheck, label } meta. |
packages/vitest/src/node/state.ts |
Updates file collection deduplication to include meta.label. |
packages/vitest/src/node/reporters/summary.ts |
Displays label badge in the summary reporter output. |
packages/vitest/src/node/reporters/blob.ts |
Includes label in default blob filename to avoid collisions. |
packages/vitest/src/node/reporters/base.ts |
Displays label badge in default reporter prefixes and failure headers. |
packages/vitest/src/node/project.ts |
Propagates root vitest label into project resolved config and spec creation API. |
packages/vitest/src/node/core.ts |
Preserves file meta (incl. label) when creating specifications during merge-reports replay. |
packages/vitest/src/node/config/serializeConfig.ts |
Serializes label into worker/runtime config. |
packages/vitest/src/node/cli/cli-config.ts |
Adds --label <label> CLI option. |
packages/ui/client/composables/explorer/utils.ts |
Stores file label into UI explorer tree nodes. |
packages/ui/client/composables/explorer/types.ts |
Extends FileTreeNode with optional label. |
packages/ui/client/components/views/ViewTestReport.vue |
Treats label as a well-known meta field in the report view. |
packages/ui/client/components/FileDetails.vue |
Displays a label badge in file details header. |
packages/ui/client/components/explorer/ExplorerItem.vue |
Displays a label badge next to file items in explorer. |
packages/ui/client/components/explorer/Explorer.vue |
Wires label into explorer item props. |
packages/runner/src/utils/collect.ts |
Salts file hashes with { typecheck, label } and plumbs meta through createFileTask. |
packages/runner/src/types/runner.ts |
Adds label to runner config typing. |
packages/runner/src/collect.ts |
Passes config.label into createFileTask meta during collection. |
docs/guide/reporters.md |
Documents using --label for multi-environment blob merges. |
docs/guide/improving-performance.md |
Updates CI sharding example to include labels and avoid artifact collisions. |
docs/guide/cli.md |
Notes default blob output path includes shard + label. |
docs/guide/cli-generated.md |
Adds generated CLI docs entry for --label. |
docs/config/label.md |
New config reference page for test.label. |
docs/.vitepress/config.ts |
Adds label to config nav. |
.github/workflows/ci.yml |
Uploads labeled blob artifacts per matrix entry and adds a merge-reports job producing HTML. |
Co-authored-by: Codex <noreply@openai.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Alternative take for #9967 (comment)
Usage example
Set
--labelwhen creating blobs:Or via test config:
The label is included in the default blob filename (
blob-linux.json) to avoid collisions. When merging, each labeled run is shown separately:How it works
test.labelis a core config option — not a blob reporter option. It generalizes the existing__typecheck__pattern:createFileTasksaltsFile.idwith the label and stores it inFile.meta.label. State deduplication treats(filepath, projectName, meta.typecheck, meta.label)as the identity key, so same-filepath files with different labels coexist naturally — with no changes toreadBlobs, no project cloning, and no ID rewriting at merge time.The blob reporter uses the label only for one thing: deriving the default output filename as
blob-(label)-(shard).json.Reporters read
meta.labeland display a badge at all times — not just during--merge-reports. A run with--label=linuxwill show the badge live as tests execute, in the same way a run with a named project shows the project badge.--merge-reportsis simply the context where having multiple labeled runs side-by-side becomes useful.The difference from #9967
TestProjectper label at read timeFile.id+File.meta.labelduring test runreadBlobschangesfile.projectName__typecheck__generalization[["blob", { label }]]reporter optiontest.labeltop-level optionDemo
I setup CI to upload html reports for
test/cliandtest/core. It's viewable on newly introduced viewer #10023.https://viewer.vitest.dev/?url=https://github.com/vitest-dev/vitest/actions/runs/23789865129/artifacts/6196385971
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
pnpm-lock.yamlunless you introduce a new test example.Tests
pnpm test:ci.Documentation
pnpm run docscommand.Changesets
feat:,fix:,perf:,docs:, orchore:.