From fcce60c1ae82337097adc24e8856e9bec881ab84 Mon Sep 17 00:00:00 2001 From: "MK (fengmk2)" Date: Fri, 23 Oct 2026 03:09:09 +0900 Subject: [PATCH] test(snapshots): keep first-start setup off the npm registry Since #3117, self-setup recovers a missing `vp-install-lock.yaml` by looking up the platform package for the binary's own version on npm, unless `VP_SKIP_DEPS_INSTALL` is set. The snapshot runner's first-start setup and the `snapshot_setup` reference home both run a dev build with no companion lockfile, so on a release branch, where that version is not published yet, every case fails with a 404 before its first step. Main only passes because the previous version is published and advertises no lockfile, which also costs one hidden npm request per case. Both setups already provision the checkout package and run in place, so set `VP_SKIP_DEPS_INSTALL=1` for them as well. Case commands still do not inherit the override, and `snapshot_setup` now asserts that. Co-Authored-By: Claude Opus 5.5 --- crates/vp_cli_snapshots/tests/cli_snapshots/README.md | 5 ++++- .../tests/cli_snapshots/fixtures/snapshot_setup/verify.mjs | 5 +++++ crates/vp_cli_snapshots/tests/cli_snapshots/main.rs | 6 ++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/crates/vp_cli_snapshots/tests/cli_snapshots/README.md b/crates/vp_cli_snapshots/tests/cli_snapshots/README.md index 5ffc728760..00d7e1b2ab 100644 --- a/crates/vp_cli_snapshots/tests/cli_snapshots/README.md +++ b/crates/vp_cli_snapshots/tests/cli_snapshots/README.md @@ -243,7 +243,10 @@ preference inference or an empty installation must create a separate home, as th `shim_package_manager_setup` fixture does. The preparation command sets `VP_SELF_SETUP_NO_MODIFY_PATH=1` so Windows self-setup does not add temporary case homes to the user's persistent `PATH`. -This override applies only to runner preparation, not to fixture commands. +It also sets `VP_SKIP_DEPS_INSTALL=1`: the case home already has the checkout +package, and setup would otherwise look up the build's version on npm, which +is unpublished on a release branch. +These overrides apply only to runner preparation, not to fixture commands. A step is a bare argv array or a table: diff --git a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/snapshot_setup/verify.mjs b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/snapshot_setup/verify.mjs index 9f1b9b5d66..91233bf5b0 100644 --- a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/snapshot_setup/verify.mjs +++ b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/snapshot_setup/verify.mjs @@ -9,6 +9,7 @@ const referenceHome = path.resolve('reference-home'); const reference = path.join(referenceHome, '.vite-plus'); const windows = process.platform === 'win32'; assert.equal(process.env.VP_SELF_SETUP_NO_MODIFY_PATH, undefined); +assert.equal(process.env.VP_SKIP_DEPS_INSTALL, undefined); if (windows) { const result = spawnSync( 'powershell.exe', @@ -46,10 +47,14 @@ for (const name of Object.keys(env)) { delete env[name]; } } +// Match the runner's preparation overrides. Without VP_SKIP_DEPS_INSTALL, +// setup looks up the platform package for the binary version on npm, which +// does not exist until that version is released. Object.assign(env, { VP_HOME: reference, VP_CLI_TEST: '1', VP_SELF_SETUP_NO_MODIFY_PATH: '1', + VP_SKIP_DEPS_INSTALL: '1', HOME: referenceHome, USERPROFILE: referenceHome, PATH: windows diff --git a/crates/vp_cli_snapshots/tests/cli_snapshots/main.rs b/crates/vp_cli_snapshots/tests/cli_snapshots/main.rs index 690c8e2fda..f7530e178b 100644 --- a/crates/vp_cli_snapshots/tests/cli_snapshots/main.rs +++ b/crates/vp_cli_snapshots/tests/cli_snapshots/main.rs @@ -746,6 +746,12 @@ impl CaseHome { // to the real user's persistent PATH. Case commands do not // inherit this override, so self-setup fixtures retain coverage. .env("VP_SELF_SETUP_NO_MODIFY_PATH", "1") + // The checkout package is already installed in this home. Without + // this, a build with no `vp-install-lock.yaml` beside it looks up + // its own version's platform package on npm, which does not exist + // on a release branch before publishing. Case commands do not + // inherit this override either. + .env("VP_SKIP_DEPS_INSTALL", "1") .output() .map_err(|e| format!("failed to run first-start setup: {e}"))?; if output.status.success() {