feat: support merge reports for non-sharded multi-environment runs#9967
feat: support merge reports for non-sharded multi-environment runs#9967hi-ogawa wants to merge 46 commits intovitest-dev:mainfrom
Conversation
✅ 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 Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… label Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The unit test with vi.mock for node:os breaks in test/cli (isolate: false) when other tests cause node:os to be cached before the mock applies. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
| import { describe, expect, test, vi } from 'vitest' | ||
| import { getWorkersCountByPercentage } from 'vitest/src/utils/workers.js' | ||
|
|
||
| vi.mock(import('node:os'), async importOriginal => ({ |
There was a problem hiding this comment.
This unit test is evacuated to test/core since vi.mock inside test/cli is breaking something.
sheremet-va
left a comment
There was a problem hiding this comment.
I am confused by the implementation. Wouldn't it make more sense to change the project's name when running tests so they are collected with new ids instead of patching them after?
I basically prototype both but I preferred current version since Blob reporter option influencing test run seems wrong and merge-time patch didn't look too far fetched. |
In my opinion, it's better to change the name when running tests to reduce the complexity. I would like to avoid regenerating and recalculating hashes. As an option, we could add a static field that influences the hash (like file.hashKey or something). I would also be useful for typechecking (which injects |
|
Based on the discussion, I'm going to explore the approach to encode "blob label" into |
Description
Example
Set
VITEST_BLOB_LABELenvironment variable (or[["blob", { label }]]in config) when creating blobs:The reporter during
--merge-reportscan show the test run results from different blob label as if they are from different projects:How it works
The label is a blob reporter option — it does not affect the test run itself.
Write side: The blob reporter stores the label in the blob payload. The label also determines the default output filename (
blob-linux.json). Project names are not mutated during the test run.Read side:
readBlobs()discovers labels from parsed blob content, clonesTestProjectinstances per label (same pattern as browser mode), then rewritesfile.projectName,File.id, child task IDs, andenvironmentModuleskeys before module graph restoration. The merge pipeline downstream sees properly-discriminated projects with no collisions.TODO
🎦 Examples from dog-fooding
test/clitest/corePlease 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:.