diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a36dd95f6a..cef2e8c0f8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1167,7 +1167,7 @@ jobs: vp uninstall -g typescript git config --global --add safe.directory /workspace - RUST_BACKTRACE=1 pnpm test + 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..8b05c40ecf 100644 --- a/.github/workflows/upgrade-deps.yml +++ b/.github/workflows/upgrade-deps.yml @@ -165,7 +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` exits 0. + 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); @@ -181,7 +181,7 @@ jobs: ### 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. 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] diff --git a/package.json b/package.json index f53cce35a1..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", + "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",