← Files Biological Sequence & Alignment ViewerARCHIVED FILE

scripts/run-opt-in-vitest.mjs

926 Bytes · Sep 30, 2026 · 23:01 UTC

↓ Download file

import { spawn } from "node:child_process";
import { fileURLToPath } from "node:url";

const [flag, ...testFiles] = process.argv.slice(2);
const supportedFlags = new Set([
  "SEQUENCE_VIEWER_LARGE_WORKSPACE_QUALIFICATION",
  "SEQUENCE_VIEWER_PUBLIC_EXAMPLES_LIVE",
]);

if (!supportedFlags.has(flag) || testFiles.length === 0) {
  throw new Error("An explicit supported Sequence qualification is required.");
}

const vitestPath = fileURLToPath(
  new URL("../node_modules/vitest/vitest.mjs", import.meta.url),
);
const child = spawn(
  process.execPath,
  [vitestPath, "run", ...testFiles, "--maxWorkers=1", "--no-file-parallelism"],
  {
    env: { ...process.env, [flag]: "1" },
    stdio: "inherit",
    windowsHide: true,
  },
);

process.exitCode = await new Promise((resolve, reject) => {
  child.once("error", reject);
  child.once("exit", (code, signal) => {
    resolve(code ?? (signal == null ? 1 : 128));
  });
});

SHA-256: b3f7991d9c59749c5ce53e2f937d764c0af7e3cb8b034ebe224df7feaed2b221