From 3fc94a5f26cca37f59fccea559db9b6f1835d65f Mon Sep 17 00:00:00 2001 From: JongKyung Lee Date: Sat, 8 Aug 2026 01:09:58 +0900 Subject: [PATCH 1/6] test: restore pnpm test as the full gate including the PTY snapshot suite #2146 removed the legacy snapshot infrastructure and trimmed the test script down to `vp test run`, leaving it identical to test:unit. Restore the historical two-tier semantics with the current PTY suite: pnpm test now runs the unit tests followed by `just snapshot-test`, while test:unit stays unit-only. The Alpine musl E2E job switches to pnpm test:unit because its container has no just or cargo (the legacy `pnpm -r snap-test` was node-only, which is why pnpm test used to work there). The upgrade-deps final validation folds its separate `just snapshot-test` step into the `pnpm test` step so the suite is not run twice. --- .github/workflows/ci.yml | 3 ++- .github/workflows/upgrade-deps.yml | 16 ++++++++-------- package.json | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3855fcfd22..bd7aceceb4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1149,7 +1149,8 @@ jobs: vp uninstall -g typescript git config --global --add safe.directory /workspace - RUST_BACKTRACE=1 pnpm test + # test:unit, not test: the container has no just/cargo for the PTY suite + RUST_BACKTRACE=1 pnpm test:unit " # Regression test for #2278: Debian slim images ship no ca-certificates diff --git a/.github/workflows/upgrade-deps.yml b/.github/workflows/upgrade-deps.yml index 52c2c43c34..47ee909d54 100644 --- a/.github/workflows/upgrade-deps.yml +++ b/.github/workflows/upgrade-deps.yml @@ -165,18 +165,18 @@ jobs: ### Final validation (this step is complete ONLY when all pass) 1. `just build` exits 0. - 2. `pnpm bootstrap-cli:ci && pnpm test` exits 0. - 3. `just snapshot-test` exits 0. Snapshot mismatches fail the run with a - unified diff. Re-record with `UPDATE_SNAPSHOTS=1` only for cosmetic - drift from the upgrade (e.g. a bumped version string in help output); - unexpected stack traces, missing output, or diverging CLI behavior are - regressions to fix. - 4. `git status --short` and `git diff --stat` have been inspected, and + 2. `pnpm bootstrap-cli:ci && pnpm test` exits 0. `pnpm test` runs the + unit tests and then the PTY snapshot suite (`just snapshot-test`). + Snapshot mismatches fail the run with a unified diff. Re-record with + `UPDATE_SNAPSHOTS=1` only for cosmetic drift from the upgrade (e.g. a + bumped version string in help output); unexpected stack traces, + missing output, or diverging CLI behavior are regressions to fix. + 3. `git status --short` and `git diff --stat` have been inspected, and every changed file is intentional for the upgrade PR. Pay special attention to generated NAPI binding files, because later CI runs fail if a build produces uncommitted binding output changes. - If any of the four above fails, diagnose the root cause, fix it, and re-run + If any of the three above fails, diagnose the root cause, fix it, and re-run the final validation. Do not exit with the task marked complete otherwise. ### Running long commands (IMPORTANT) diff --git a/package.json b/package.json index f53cce35a1..572475f3a2 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "local-registry:kill": "node packages/tools/src/local-npm-registry.ts --kill", "tsgo": "tsgo -b tsconfig.json", "lint": "vp lint --type-aware --type-check --threads 4", - "test": "vp test run", + "test": "vp test run && just snapshot-test", "snapshot-test": "just snapshot-test", "fmt": "vp fmt", "test:unit": "vp test run", From 45175eb11cde3735176b7b6ae366e02a83246d98 Mon Sep 17 00:00:00 2001 From: JongKyung Lee Date: Sat, 8 Aug 2026 01:11:52 +0900 Subject: [PATCH 2/6] ci(upgrade-deps): keep unit and snapshot validation as separate steps Use pnpm test:unit in the final-validation gate instead of folding the snapshot suite into pnpm test. The agent re-records snapshot drift with UPDATE_SNAPSHOTS=1 just snapshot-test and re-runs only that step, so a combined gate would re-run the unit tests on every snapshot iteration and blur which suite failed. --- .github/workflows/upgrade-deps.yml | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/.github/workflows/upgrade-deps.yml b/.github/workflows/upgrade-deps.yml index 47ee909d54..823c702ede 100644 --- a/.github/workflows/upgrade-deps.yml +++ b/.github/workflows/upgrade-deps.yml @@ -165,23 +165,25 @@ jobs: ### Final validation (this step is complete ONLY when all pass) 1. `just build` exits 0. - 2. `pnpm bootstrap-cli:ci && pnpm test` exits 0. `pnpm test` runs the - unit tests and then the PTY snapshot suite (`just snapshot-test`). - Snapshot mismatches fail the run with a unified diff. Re-record with - `UPDATE_SNAPSHOTS=1` only for cosmetic drift from the upgrade (e.g. a - bumped version string in help output); unexpected stack traces, - missing output, or diverging CLI behavior are regressions to fix. - 3. `git status --short` and `git diff --stat` have been inspected, and + 2. `pnpm bootstrap-cli:ci && pnpm test:unit` exits 0. Use `test:unit`, + not `test`: the snapshot suite runs as its own step below so a + snapshot re-record does not re-run the unit tests. + 3. `just snapshot-test` exits 0. Snapshot mismatches fail the run with a + unified diff. Re-record with `UPDATE_SNAPSHOTS=1` only for cosmetic + drift from the upgrade (e.g. a bumped version string in help output); + unexpected stack traces, missing output, or diverging CLI behavior are + regressions to fix. + 4. `git status --short` and `git diff --stat` have been inspected, and every changed file is intentional for the upgrade PR. Pay special attention to generated NAPI binding files, because later CI runs fail if a build produces uncommitted binding output changes. - If any of the three above fails, diagnose the root cause, fix it, and re-run + If any of the four above fails, diagnose the root cause, fix it, and re-run the final validation. Do not exit with the task marked complete otherwise. ### Running long commands (IMPORTANT) Run every long-running command (`just build`, `pnpm bootstrap-cli:ci`, - `pnpm test`, `cargo check`, etc.) in the FOREGROUND — a single Bash tool call + `pnpm test:unit`, `cargo check`, etc.) in the FOREGROUND — a single Bash tool call that blocks until the command exits. The Bash tool already gives you a 10-minute timeout per call, which is enough for these builds. From aaacade507222a608098ed5aa945c1d78b5dc6a6 Mon Sep 17 00:00:00 2001 From: JongKyung Lee Date: Sat, 8 Aug 2026 01:12:40 +0900 Subject: [PATCH 3/6] ci: drop redundant comment on the Alpine test:unit invocation --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bd7aceceb4..625103fa6c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1149,7 +1149,6 @@ jobs: vp uninstall -g typescript git config --global --add safe.directory /workspace - # test:unit, not test: the container has no just/cargo for the PTY suite RUST_BACKTRACE=1 pnpm test:unit " From 0f81e931ec23c1390ea21fe765deb82e9d049fac Mon Sep 17 00:00:00 2001 From: JongKyung Lee Date: Sat, 8 Aug 2026 01:15:59 +0900 Subject: [PATCH 4/6] ci(upgrade-deps): drop redundant test:unit rationale from the validation step --- .github/workflows/upgrade-deps.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/upgrade-deps.yml b/.github/workflows/upgrade-deps.yml index 823c702ede..8b05c40ecf 100644 --- a/.github/workflows/upgrade-deps.yml +++ b/.github/workflows/upgrade-deps.yml @@ -165,9 +165,7 @@ jobs: ### Final validation (this step is complete ONLY when all pass) 1. `just build` exits 0. - 2. `pnpm bootstrap-cli:ci && pnpm test:unit` exits 0. Use `test:unit`, - not `test`: the snapshot suite runs as its own step below so a - snapshot re-record does not re-run the unit tests. + 2. `pnpm bootstrap-cli:ci && pnpm test:unit` exits 0. 3. `just snapshot-test` exits 0. Snapshot mismatches fail the run with a unified diff. Re-record with `UPDATE_SNAPSHOTS=1` only for cosmetic drift from the upgrade (e.g. a bumped version string in help output); From 2665d8a7eb89742d7e83372543aa19b2dfbc5e9c Mon Sep 17 00:00:00 2001 From: JongKyung Lee Date: Sun, 9 Aug 2026 21:27:26 +0900 Subject: [PATCH 5/6] build(just): install Playwright Chromium before the PTY snapshot suite The vitest_browser_mode case launches Chromium with PLAYWRIGHT_BROWSERS_PATH=0, which only the dedicated CI snapshot jobs provisioned. Now that pnpm test reaches the suite on a fresh checkout, snapshot-test installs the browser itself (idempotent, per-platform helper because the Windows shell is PowerShell). --- justfile | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/justfile b/justfile index 56483fc4db..f241b9ea11 100644 --- a/justfile +++ b/justfile @@ -81,15 +81,26 @@ test: $packages = Get-ChildItem -Path crates -Directory | Where-Object { $_.Name -ne 'vp_cli_snapshots' } | ForEach-Object { '-p'; $_.Name }; $Env:RUST_MIN_STACK='8388608'; $Env:__COMPAT_LAYER='RunAsInvoker'; cargo test @packages -p vite-plus-cli # PTY-based CLI snapshot tests (crates/vp_cli_snapshots). Builds the global -# binary and shim template first so the runner never tests a stale build. +# binary and shim template first so the runner never tests a stale build, and +# installs Playwright Chromium for the browser-mode cases (idempotent). # Filter by trial name substring: `just snapshot-test create`. Accept snapshot changes with # `UPDATE_SNAPSHOTS=1 just snapshot-test`. Local-flavor cases additionally # need a built packages/cli (`pnpm build`); the runner fails fast when dist # is missing or stale. Use snapshot-test-global on checkouts without one. -snapshot-test *args='': +snapshot-test *args='': _install_chromium cargo build -p vp_global_cli -p vp_trampoline cargo test -p vp_cli_snapshots -- {{args}} +# Browser-mode snapshot cases run with PLAYWRIGHT_BROWSERS_PATH=0, so the +# browser must be installed into node_modules with the same setting. +[unix] +_install_chromium: + PLAYWRIGHT_BROWSERS_PATH=0 pnpm exec playwright install chromium + +[windows] +_install_chromium: + $Env:PLAYWRIGHT_BROWSERS_PATH='0'; pnpm exec playwright install chromium + # Global flavor + vpt cases only: needs no JS build, for Rust-side work on # a checkout that never ran `pnpm build`. [unix] From 4a8df3f4db1e5f44331a4d607d8eef5d497d96c9 Mon Sep 17 00:00:00 2001 From: JongKyung Lee Date: Sun, 9 Aug 2026 22:30:42 +0900 Subject: [PATCH 6/6] fix(scripts): correct test command to remove 'run' for consistency --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 572475f3a2..bd6549caa3 100644 --- a/package.json +++ b/package.json @@ -13,10 +13,10 @@ "local-registry:kill": "node packages/tools/src/local-npm-registry.ts --kill", "tsgo": "tsgo -b tsconfig.json", "lint": "vp lint --type-aware --type-check --threads 4", - "test": "vp test run && just snapshot-test", + "test": "vp test && just snapshot-test", "snapshot-test": "just snapshot-test", + "test:unit": "vp test", "fmt": "vp fmt", - "test:unit": "vp test run", "docs:dev": "pnpm -C docs dev", "docs:build": "pnpm -C docs build", "docs:update-trusted-stack-stats": "pnpm -C docs update-trusted-stack-stats",