Skip to content

Commit 32cbf53

Browse files
committed
fix: run sync script before testing too
1 parent 020a5d0 commit 32cbf53

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

packages/e2e-tests/e2e-server.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import treeKill from 'tree-kill';
44
import fs from 'node:fs';
55
import path from 'node:path';
66
import process from 'node:process';
7+
import { rootDir } from 'vitest/node';
78
const isWin = process.platform === 'win32';
89

910
async function startedOnPort(serverProcess, port, timeout) {
@@ -77,6 +78,16 @@ export async function serve(root, isBuild, port) {
7778
}
7879
};
7980

81+
const pkg = JSON.parse(fs.readFileSync(path.join(rootDir, 'package.json'), 'utf-8'));
82+
if (pkg.scripts?.sync) {
83+
try {
84+
await execa('pnpm', ['sync']);
85+
} catch (e) {
86+
console.error(`Failed to run sync script in ${rootDir}`);
87+
throw e;
88+
}
89+
}
90+
8091
if (isBuild) {
8192
let buildResult;
8293
let hasErr = false;

0 commit comments

Comments
 (0)