Skip to content

Commit 2fdeb60

Browse files
committed
test(e2e): verify local tgz packages are installed after migration
Add verify-install.ts that checks vite, vitest, and vite-plus are all installed at version 0.0.0 (the local tgz version). This catches override failures early before running project commands.
1 parent 8aebed1 commit 2fdeb60

2 files changed

Lines changed: 39 additions & 0 deletions

File tree

.github/workflows/e2e-test.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,11 @@ jobs:
321321
node $GITHUB_WORKSPACE/ecosystem-ci/patch-project.ts ${{ matrix.project.name }}
322322
vp install --no-frozen-lockfile
323323
324+
- name: Verify local tgz packages installed
325+
working-directory: ${{ runner.temp }}/vite-plus-ecosystem-ci/${{ matrix.project.name }}${{ matrix.project.directory && format('/{0}', matrix.project.directory) || '' }}
326+
shell: bash
327+
run: node $GITHUB_WORKSPACE/ecosystem-ci/verify-install.ts
328+
324329
- name: Run vite-plus commands in ${{ matrix.project.name }}
325330
working-directory: ${{ runner.temp }}/vite-plus-ecosystem-ci/${{ matrix.project.name }}${{ matrix.project.directory && format('/{0}', matrix.project.directory) || '' }}
326331
run: ${{ matrix.project.command }}

ecosystem-ci/verify-install.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { createRequire } from 'node:module';
2+
3+
const require = createRequire(`${process.cwd()}/`);
4+
5+
const expectedVersion = '0.0.0';
6+
7+
const packages = [
8+
{ name: 'vite', resolve: 'vite/package.json' },
9+
{ name: 'vitest', resolve: 'vitest/package.json' },
10+
{ name: 'vite-plus', resolve: 'vite-plus/package.json' },
11+
];
12+
13+
let failed = false;
14+
15+
for (const { name, resolve } of packages) {
16+
try {
17+
const pkg = require(resolve) as { version: string; name: string };
18+
if (pkg.version !== expectedVersion) {
19+
console.error(
20+
`✗ ${name}: expected version ${expectedVersion}, got ${pkg.version} (${pkg.name})`,
21+
);
22+
failed = true;
23+
} else {
24+
console.log(`✓ ${name}@${pkg.version} (${pkg.name})`);
25+
}
26+
} catch {
27+
console.error(`✗ ${name}: not installed`);
28+
failed = true;
29+
}
30+
}
31+
32+
if (failed) {
33+
process.exit(1);
34+
}

0 commit comments

Comments
 (0)