返回 CodeWhale
vitest.global-setup.ts
根目录 / web / vitest.global-setup.ts
1 import { execFileSync } from "node:child_process";
2 import { fileURLToPath } from "node:url";
3
4 /**
5 * Derive the untracked build inputs before any test file imports them.
6 * `lib/changelog.generated.ts` and `lib/install-guide.generated.ts` are not
7 * committed (see web/.gitignore), so a bare `vitest run` on a fresh checkout
8 * must write them from CHANGELOG.md and docs/INSTALL.md first. Facts stay out
9 * of this list on purpose: `facts.generated.ts` is committed, and rewriting it
10 * here would hide the drift `npm run check:facts` exists to catch.
11 */
12 export default function setup() {
13 for (const script of ["derive-changelog.mjs", "derive-install.mjs"]) {
14 execFileSync(process.execPath, [fileURLToPath(new URL(`./scripts/${script}`, import.meta.url))], {
15 stdio: "inherit",
16 });
17 }
18 }
19
19 lines TYPESCRIPT