Something went wrong. Try again.
because I got bored of customising my CV for every job
Something went wrong. Try again.
1.8 kB · 73 lines
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374/* eslint-disable no-console */const { execSync, spawn } = require("node:child_process");
function sleep(ms) { return new Promise((resolve) => setTimeout(resolve, ms));}
async function main() { execSync("npm run prisma:deploy", { stdio: "inherit" }); execSync("npm run build", { stdio: "inherit" });
const fs = require("node:fs"); const path = require("node:path"); function findMain() { const direct = path.join(process.cwd(), "dist", "main.js"); if (fs.existsSync(direct)) return direct; const candidates = [ path.join(process.cwd(), "dist", "src", "main.js"), path.join(process.cwd(), "dist", "apps", "server", "src", "main.js"), ]; for (const c of candidates) if (fs.existsSync(c)) return c; return null; }
let mainPath = findMain(); let retries = 10; while (!mainPath && retries > 0) { await sleep(300); retries--; mainPath = findMain(); } if (!mainPath) { throw new Error("dist/main.js not found after build; aborting c8 run"); }
const server = spawn( "npx", [ "c8", "--include", "dist/**/*.js", "--exclude", "dist/**/test/**", "-r", "text", "-r", "lcov", "node", mainPath, ], { stdio: "inherit" }, );
await sleep(1500);
execSync("npm run seed:test", { stdio: "inherit" });
const env = { ...process.env, E2E_EXTERNAL_URL: "http://localhost:3000" }; execSync("npm run test:e2e -- --maxWorkers=50%", { stdio: "inherit", env });
try { server.kill("SIGTERM"); } catch {} await sleep(1000); execSync( "npx c8 report --include 'dist/**/*.js' --exclude 'dist/**/test/**' -r text -r lcov", { stdio: "inherit", shell: "/bin/sh" }, );}
main().catch(() => { process.exit(1);});