Skip to content

test(snapshots): reduce repeated setup and worker idle time - #2771

Merged
fengmk2 merged 10 commits into
mainfrom
review/snapshot-testing
Sep 22, 2026
Merged

fengmk2 merged 10 commits into
mainfrom
review/snapshot-testing

Conversation

@fengmk2

@fengmk2 fengmk2 commented Sep 21, 2026 •

Copy link
Copy Markdown
Member

Snapshot runs repeat package preparation on Windows, occupy workers while waiting for exclusive access, and defer workspace cleanup until the end.

The runner shares complete tarballs through VP_SNAP_PACKAGES_DIR. It runs parallel cases before isolated cases. Generated nextest settings reserve all workers before an isolated case starts. Existing locks still protect these cases. Each CI shard uses eight workers.

Each case removes its workspace when it finishes. Exact nextest runs read only the selected fixture. A migration fixture sets slowTestThreshold so machine load cannot add passing-test details to its snapshot.

Before setup, each case sets its package managers to managed in config.json. The new installation creates environment files and shims once. Preparation sets VP_SELF_SETUP_NO_MODIFY_PATH=1 to prevent changes to the Windows user PATH. Fixture commands do not inherit this setting.

VP_SNAP_ARTIFACTS_DIR records phase timings and preserves command output and snapshot differences when a case fails. CI uploads these artifacts for inspection after cleanup.

CI measurements compare 1e165266f with PR head e6c45e3ea, merged onto that same commit. The baseline ran three times; the optimized version ran four times. The optimized suite retains every existing case and adds two cases per platform that compare setup results.

Times measure Run PTY snapshot tests, including cleanup. They exclude builds, environment preparation, queue delays, and artifact uploads. Each sample uses the slowest of three successful shards on one platform. Values show medians and full ranges, in seconds.

Platform Valid samples, before / after Before: median (range) After: median (range) Median reduction
Windows 3 / 4 209 (203–235) 153.5 (145–164) 26.6%
Linux 3 / 4 159 (155–177) 136.5 (123–140) 14.2%
macOS 3 / 3 190 (189–201) 147 (144–153) 22.6%

Windows and macOS median reductions exceed 20%.
Linux remains below the 20% target.

Optimized attempt 3 failed on macOS because packed_browser_defines timed out while connecting to Chromium. That platform sample is excluded from timing statistics. Its failed shard took 265 seconds. Attempt 4 reran the full workflow. All successful samples remain in the table. This timeout remains a reliability issue.

Baseline attempts: 1, 2, 3.

Optimized attempts: 1, 2, 3, 4.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview URL: https://review-snapshot-testing-viteplus-dev.voidzero-docs.workers.dev (commit 32cc707)

This URL reflects your latest Preview deployment

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://98332aa2-viteplus-dev.voidzero-docs.workers.dev 32cc707 2026-09-22T15:05:51.318Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://a4021420-viteplus-dev.voidzero-docs.workers.dev e6c45e3 2026-09-22T08:04:50.267Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://3d02562b-viteplus-dev.voidzero-docs.workers.dev 6ceea3f 2026-09-22T07:46:07.880Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://f7a40961-viteplus-dev.voidzero-docs.workers.dev 4d0074d 2026-09-22T07:33:59.525Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://25cdc9ad-viteplus-dev.voidzero-docs.workers.dev ce6f278 2026-09-22T03:47:40.102Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://56fefcde-viteplus-dev.voidzero-docs.workers.dev 5914cf5 2026-09-22T03:46:22.237Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://0eb92e49-viteplus-dev.voidzero-docs.workers.dev 77afd3e 2026-09-21T16:01:50.720Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://2c13cbe5-viteplus-dev.voidzero-docs.workers.dev ca469d4 2026-09-21T13:57:17.996Z Visit the dashboard ↗

@fengmk2 fengmk2 changed the title test(snapshots): share package preparation and retain diagnostics test(snapshots): reduce repeated setup and worker idle time Sep 21, 2026
@fengmk2
fengmk2 force-pushed the review/snapshot-testing branch from ad908ab to 77afd3e Compare September 21, 2026 15:59
@fengmk2 fengmk2 self-assigned this Sep 21, 2026
@fengmk2
fengmk2 force-pushed the review/snapshot-testing branch 2 times, most recently from 5914cf5 to ce6f278 Compare September 22, 2026 03:46
@fengmk2
fengmk2 force-pushed the review/snapshot-testing branch from e6c45e3 to 32cc707 Compare September 22, 2026 15:03
@fengmk2
fengmk2 marked this pull request as ready for review September 22, 2026 15:06
@fengmk2
fengmk2 requested a review from wan9chi September 22, 2026 15:06
@fengmk2
fengmk2 merged commit 911620f into main Sep 22, 2026
49 checks passed
@fengmk2
fengmk2 deleted the review/snapshot-testing branch September 22, 2026 15:42
wan9chi added a commit that referenced this pull request Sep 26, 2026
The `snapshot_setup` fixture from #2771 copies only the `vp` binary into
its reference home. `vp env setup --refresh` then finds no
`current/node_modules/vite-plus` and installs `vite-plus@<binary
version>` from npm. On `main` that version is already published, so the
case passes (with a network download). On a release branch the version
is not published yet, so both flavors fail on every platform with
`Failed to install production dependencies`. This blocks the v1.0.0-rc.1
release PR (#2818).

The fixture now links the case's own `vite-plus` package into the
reference home, as the snapshot runner does for the prepared home. The
comparison covers `config.json`, `bin`, `fallback-bin`, and the
environment files, not `current`, so the assertions are unchanged.

Validation, with a runner-style prepared home built from the published
`1.0.0-rc.0` binary and the npm registry pointed at an unreachable
address, so the binary's version is effectively unpublished:

| `verify.mjs` | Result |
| --- | --- |
| Before | Fails at `env setup --refresh` while it installs `vite-plus`
(the CI failure) |
| After | Prints both expected snapshot lines and exits `0` without a
network install |
wan9chi added a commit that referenced this pull request Sep 26, 2026
Task cache settings now live under `cache`, and `vp migrate` moves
existing task settings for you. `vp lint` and `vp fmt` run from a
package directory now pick the same config as your editor, and piped
`vp` output exits cleanly.

### Breaking Changes

Task cache settings in `run.tasks` now go inside `cache`
([#2813](#2813),
[#2814](#2814),
[#2823](#2823),
[vite-task#749](voidzero-dev/vite-task#749)), by
@wan9chi.

| Old (top level of a task) | New |
| --- | --- |
| `env` | `cache.env` |
| `untrackedEnv` | `cache.untrackedEnv` |
| `input` | `cache.input` |
| `output` | `cache.output` |

`cache: true` is the same as `cache: {}`. After upgrading, a task that
still uses the old top-level fields fails with an error that points to
`vp migrate`. Run `vp migrate` to move the fields in `vite.config.*` for
the workspace root and every package. It warns about tasks in
`vite.config.*` that it cannot rewrite safely. Tasks created in other
modules, such as by a shared helper function, are not detected, so move
their fields by hand; the error lists every task that still needs it.
Projects whose tasks do not use these fields need no changes. See the
[task cache migration
rules](https://viteplus.dev/guide/migrate-rules#task-cache-configuration)
and the [`cache` reference](https://viteplus.dev/config/run#cache).

### Highlights

- `vp lint` and `vp fmt` run from a package directory now use the same
config as Oxlint, Oxfmt, and the language server, so results match your
editor. `vp check` still applies the workspace-root settings
([#2807](#2807)), by
@fengmk2.
- Global `vp` commands now exit cleanly when piped into a command that
closes early, such as `vp --version | head -n 1`, instead of aborting
with exit code 134
([#2785](#2785),
[#2793](#2793)), by
@naokihaba.
- Cached tasks on macOS no longer intermittently fail with `oils I/O
error (main): No such process`
([vite-task#703](voidzero-dev/vite-task#703)),
by @lifeiscontent.

### Features

- The bundled tools update `vite@8.3.0` -> `vite@8.3.1`,
`rolldown@1.2.9` -> `rolldown@1.2.11`, and `oxlint-tsgolint@7.0.2002` ->
`oxlint-tsgolint@7.0.2003`
([#2805](#2805),
[#2812](#2812)), by
@voidzero-guard[bot].

### Fixes & Enhancements

- Async `defineConfig` callbacks now type-check lint and format options,
such as `'warn'` rule severities, the same way as synchronous callbacks,
so configs updated by `vp migrate` no longer fail with `TS2769`
([#2803](#2803)), by
@TheAlexLichter.
- `vp test --help` now lists the Vitest 5 options `--repeats`,
`--injectCjsGlobals`, `--fsModuleCache`, `--fsModuleCachePath`, and
`--sharedViteServer`
([#2809](#2809)), by
@Marve10s.
- On Windows, `vp run` now matches environment variable names regardless
of letter case
([vite-task#747](voidzero-dev/vite-task#747)),
by @wan9chi.

### Docs

- The copy prompt dialog no longer nests scroll areas and shows clearer
copy feedback
([#2794](#2794),
[#2799](#2799)), by
@liangmiQwQ and @Boshen.

### Chore

- Snapshot tests share prepared packages and one Chromium process, run
faster on every platform, and no longer read the live npm registry in
the standalone npm fallback case
([#2771](#2771),
[#2786](#2786),
[#2797](#2797)), by
@fengmk2 and @voidzero-guard[bot].
- The snapshot setup check links the local `vite-plus` package into its
reference home instead of installing the version under release from npm,
so it passes before that version is published
([#2819](#2819)), by
@wan9chi.
- The preview migration harness installs a project's committed
dependencies before running `vp migrate`, so the Vitest 5 migration can
read the original Vitest version
([#2822](#2822)), by
@wan9chi.
- The standalone install workflow loads the generated environment before
running `vp env doctor`
([#2790](#2790)), by
@naokihaba.

### Bundled Versions

| Tool | Version | Source |
| --- | --- | --- |
| vite | `8.3.1` |
[`39ddf7c`](vitejs/vite@39ddf7c)
|
| rolldown | `1.2.11` |
[`8df4219`](rolldown/rolldown@8df4219)
|
| tsdown | `0.23.0` | [npm](https://npmx.dev/package/tsdown/v/0.23.0) |
| vitest | `5.0.1` | [npm](https://npmx.dev/package/vitest/v/5.0.1) |
| oxlint | `1.85.0` | [npm](https://npmx.dev/package/oxlint/v/1.85.0) |
| oxlint-tsgolint | `7.0.2003` |
[npm](https://npmx.dev/package/oxlint-tsgolint/v/7.0.2003) |
| oxfmt | `0.70.0` | [npm](https://npmx.dev/package/oxfmt/v/0.70.0) |

### Upgrade

```bash
vp upgrade
```

### New Contributors

@Marve10s

**Full Changelog**:
v1.0.0-rc.0...v1.0.0-rc.1

---

Merging this PR will trigger the release workflow.

---------

Co-authored-by: voidzero-guard[bot] <278573678+voidzero-guard[bot]@users.noreply.github.com>
Co-authored-by: wan9chi <me@wan9chi.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants