Conversation
Re-enable the vp CLI cache that was temporarily disabled due to the Windows `Cannot find module 'which'` issue (#10). Add SETUP_VP_FORCE_INSTALL env var check to bypass cache in CI testing.
There was a problem hiding this comment.
Pull request overview
This PR re-enables caching for the Vite+ (vp) CLI in the setup-vp GitHub Action, adding a CI-controlled bypass to validate both cached and fresh install flows, and re-enabling the previously skipped cache unit tests.
Changes:
- Re-enable
vpCLI cache restore/save logic, with an opt-out viaSETUP_VP_FORCE_INSTALL=true. - Wire
SETUP_VP_FORCE_INSTALLto skip cache restore. - Re-enable unit tests for
restoreVpCacheandsaveVpCache.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/cache-vp.ts |
Restores vp cache restore/save behavior and adds SETUP_VP_FORCE_INSTALL restore bypass. |
src/cache-vp.test.ts |
Un-skips and runs cache-related unit tests again. |
Comments suppressed due to low confidence (1)
src/cache-vp.test.ts:90
- The new
SETUP_VP_FORCE_INSTALLbranch inrestoreVpCacheisn’t covered by unit tests, and these tests don’t explicitly clear/stub that env var. If a developer (or CI) runs tests withSETUP_VP_FORCE_INSTALL=trueset, these cases will fail unexpectedly. Consider stubbing it to "false" inbeforeEach, and add a test asserting thatrestoreVpCacheskips the restore whenSETUP_VP_FORCE_INSTALLis "true" (and that no cache restore call is made).
describe("restoreVpCache", () => {
beforeEach(() => {
vi.stubEnv("RUNNER_OS", "Linux");
vi.stubEnv("HOME", "/home/runner");
});
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| export async function restoreVpCache(version: string, nodeVersion: string): Promise<boolean> { | ||
| // FIXME: Re-enable vp CLI caching after the new version of vite-plus is released | ||
| // that fixes the Windows `Cannot find module 'which'` issue (#10). | ||
| info("Vp CLI caching is temporarily disabled"); | ||
| return false; | ||
| if (process.env.SETUP_VP_FORCE_INSTALL === "true") { | ||
| info("Skipping vp cache restore (SETUP_VP_FORCE_INSTALL=true)"); | ||
| return false; | ||
| } |
There was a problem hiding this comment.
When SETUP_VP_FORCE_INSTALL is "true", this early return happens before computing/saving VpCachePrimaryKey. As a result, the post step’s saveVpCache() will always see an empty primary key and skip saving, so the “fresh install” path can never populate/warm the vp cache. If the intent is to bypass only the restore, consider still generating the cache key and calling saveState(State.VpCachePrimaryKey, ...) (and logging) while skipping just the restoreCache(...) call.
|
Files extracted from the cache cannot be used directly, let's wait for voidzero-dev/vite-plus#744 |
Summary
Cannot find module 'which'issue (Windows runner failures with latest action version #10)SETUP_VP_FORCE_INSTALLenv var to bypass cache restore, enabling CI to test both cached and fresh install pathsrestoreVpCacheandsaveVpCacheTest plan
force-install: false(cached path)force-install: true(fresh install path)🤖 Generated with Claude Code