Skip to content

Commit ef49ed0

Browse files
branchseerclaude
andcommitted
feat: enable cacheScripts and add cache miss scenario in e2e tests
- Enable `cacheScripts: true` in patch-project.ts after migration so `vp run` commands exercise the task cache hit/miss code paths. - Add a third "cache miss" run to the e2e workflow that modifies package.json between runs to trigger PostRunFingerprintMismatch. The e2e flow is now: first run (cache miss NotFound) → second run (cache hit) → invalidate → third run (cache miss FingerprintMismatch). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 8efd478 commit ef49ed0

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

.github/workflows/e2e-test.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,25 @@ jobs:
301301
VITE_LOG_OUTPUT_DIR: ${{ runner.temp }}/trace-artifacts
302302
run: ${{ matrix.project.command }}
303303

304+
- name: Invalidate task cache in ${{ matrix.project.name }}
305+
working-directory: ${{ runner.temp }}/vite-plus-ecosystem-ci/${{ matrix.project.name }}${{ matrix.project.directory && format('/{0}', matrix.project.directory) || '' }}
306+
run: |
307+
# Modify package.json to trigger PostRunFingerprintMismatch on next vp run
308+
node -e "
309+
const fs = require('fs');
310+
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf-8'));
311+
pkg._cacheInvalidation = Date.now().toString();
312+
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n');
313+
"
314+
315+
- name: Run vite-plus commands (cache miss run) in ${{ matrix.project.name }}
316+
working-directory: ${{ runner.temp }}/vite-plus-ecosystem-ci/${{ matrix.project.name }}${{ matrix.project.directory && format('/{0}', matrix.project.directory) || '' }}
317+
env:
318+
VITE_LOG: debug
319+
VITE_LOG_OUTPUT: chrome-json
320+
VITE_LOG_OUTPUT_DIR: ${{ runner.temp }}/trace-artifacts
321+
run: ${{ matrix.project.command }}
322+
304323
- name: Collect trace files
305324
if: always()
306325
shell: bash

ecosystem-ci/patch-project.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,12 @@ execSync(`${cli} migrate --no-agent --no-interactive`, {
4444
VITE_PLUS_VERSION: `file:${tgzDir}/vite-plus-0.0.0.tgz`,
4545
},
4646
});
47+
48+
// Enable cacheScripts so e2e tests exercise the cache hit/miss paths
49+
const viteConfigPath = join(cwd, 'vite.config.ts');
50+
const viteConfig = await readFile(viteConfigPath, 'utf-8');
51+
await writeFile(
52+
viteConfigPath,
53+
viteConfig.replace('defineConfig({', 'defineConfig({\n run: { cacheScripts: true },'),
54+
'utf-8',
55+
);

0 commit comments

Comments
 (0)