72 lines
1.8 KiB
JavaScript
72 lines
1.8 KiB
JavaScript
import { spawn } from "node:child_process";
|
|
import { fileURLToPath } from "node:url";
|
|
const cwd = fileURLToPath(new URL("../", import.meta.url));
|
|
function run(file, env = process.env) {
|
|
return new Promise((resolve, reject) => {
|
|
const child = spawn(process.execPath, [file], {
|
|
cwd,
|
|
env,
|
|
stdio: "inherit",
|
|
windowsHide: true,
|
|
});
|
|
child.once("error", reject);
|
|
child.once("exit", (code) =>
|
|
code === 0 ? resolve() : reject(Error(`${file} exited ${code}`)),
|
|
);
|
|
});
|
|
}
|
|
await run("scripts/check.mjs");
|
|
await run("scripts/build-package.mjs");
|
|
const server = spawn(process.execPath, ["scripts/serve.mjs"], {
|
|
cwd,
|
|
env: { ...process.env, PORT: "0" },
|
|
stdio: ["ignore", "pipe", "inherit"],
|
|
windowsHide: true,
|
|
});
|
|
try {
|
|
const base = await new Promise((resolve, reject) => {
|
|
const timeout = setTimeout(
|
|
() => reject(Error("QA server did not start")),
|
|
10000,
|
|
);
|
|
server.once("error", (e) => {
|
|
clearTimeout(timeout);
|
|
reject(e);
|
|
});
|
|
server.once("exit", (code) => {
|
|
clearTimeout(timeout);
|
|
reject(Error(`QA server exited ${code}`));
|
|
});
|
|
server.stdout.on("data", (data) => {
|
|
const match = String(data).match(/http:\/\/127\.0\.0\.1:\d+/);
|
|
if (match) {
|
|
clearTimeout(timeout);
|
|
resolve(match[0]);
|
|
}
|
|
});
|
|
});
|
|
const env = { ...process.env, BASE_URL: base };
|
|
for (const name of [
|
|
"browser",
|
|
"dock",
|
|
"approved-dock",
|
|
"site",
|
|
"identity",
|
|
"totp-layout",
|
|
"icons",
|
|
"workspaces",
|
|
"navigation-feedback",
|
|
"search-select",
|
|
"package",
|
|
"system-pages",
|
|
]) {
|
|
console.log(`\nChecking ${name}`);
|
|
await run(`tests/${name}.mjs`, env);
|
|
}
|
|
console.log(
|
|
"Release checks passed. Browser coverage follows PLAYWRIGHT_EXECUTABLE_PATH; this does not certify other engines.",
|
|
);
|
|
} finally {
|
|
server.kill();
|
|
}
|