From e55677fddc240dd55afc24af0c3d11c639f05f4e Mon Sep 17 00:00:00 2001 From: wan9chi Date: Fri, 25 Sep 2026 23:34:03 +0800 Subject: [PATCH] test(snapshots): provision vite-plus in the setup reference home The snapshot_setup fixture copied only the vp binary into its reference home, so `vp env setup --refresh` installed vite-plus@ from npm. That version does not exist on a release branch before the release is published, which failed the case on every platform. Link the case's own vite-plus package into the reference home, as the runner does for the prepared home. The comparison excludes `current`. --- .../cli_snapshots/fixtures/snapshot_setup/verify.mjs | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 0032f4112a..9f1b9b5d66 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 @@ -29,6 +29,16 @@ fs.mkdirSync(bin, { recursive: true }); for (const name of windows ? [binaryName, 'vp-shim.exe'] : [binaryName]) { fs.copyFileSync(path.join(prepared, 'current', 'bin', name), path.join(bin, name)); } +// Provision the case's own vite-plus package like the prepared home. Without +// it, setup installs vite-plus@ from npm, which does not exist +// until that version is released. +const packageDir = path.join(reference, 'current', 'node_modules', 'vite-plus'); +fs.mkdirSync(path.dirname(packageDir), { recursive: true }); +fs.symlinkSync( + fs.realpathSync(path.join(prepared, 'current', 'node_modules', 'vite-plus')), + packageDir, + windows ? 'junction' : 'dir', +); const env = { ...process.env }; for (const name of Object.keys(env)) {