56 lines
1.6 KiB
JavaScript
56 lines
1.6 KiB
JavaScript
import { spawnSync } from "node:child_process";
|
|
import path from "node:path";
|
|
import process from "node:process";
|
|
|
|
const extraArgs = process.argv.slice(2);
|
|
const conflicting = extraArgs.find(
|
|
(arg) =>
|
|
arg === "--project" ||
|
|
arg.startsWith("--project=") ||
|
|
arg === "--workers" ||
|
|
arg.startsWith("--workers="),
|
|
);
|
|
|
|
if (conflicting) {
|
|
console.error(
|
|
`e2e 전체 러너는 프로젝트와 worker를 단계별로 소유합니다 (${conflicting}). ` +
|
|
"focused 실행은 npm run e2e:parallel 또는 npm run e2e:single-run을 사용하세요.",
|
|
);
|
|
process.exit(2);
|
|
}
|
|
|
|
const playwrightCli = path.resolve(
|
|
process.cwd(),
|
|
"node_modules/@playwright/test/cli.js",
|
|
);
|
|
|
|
function runPhase(label, args) {
|
|
console.log(`\n[e2e] ${label}`);
|
|
const result = spawnSync(
|
|
process.execPath,
|
|
[playwrightCli, "test", ...args, ...extraArgs],
|
|
{
|
|
cwd: process.cwd(),
|
|
env: process.env,
|
|
stdio: "inherit",
|
|
},
|
|
);
|
|
if (result.error) {
|
|
console.error(`[e2e] ${label} 실행 실패: ${result.error.message}`);
|
|
process.exit(1);
|
|
}
|
|
if (result.status !== 0) process.exit(result.status ?? 1);
|
|
}
|
|
|
|
// Route-fixture/browser-only tests may use the machine's worker pool. Durable DB,
|
|
// provider, and engine tests must start only after that pool drains and then run
|
|
// one at a time against the single local API/gateway runtime.
|
|
runPhase("fixture desktop/mobile 병렬 단계", [
|
|
"--project=chromium-desktop",
|
|
"--project=chromium-mobile",
|
|
`--workers=${process.env.E2E_PARALLEL_WORKERS ?? "4"}`,
|
|
]);
|
|
runPhase("DB/engine single-run 직렬 단계", [
|
|
"--project=chromium-single-run",
|
|
"--workers=1",
|
|
]);
|