Lines 15–24 at 318 (were 15–24 at 97)
1515// A change to setup (package.json, the lockfile, tsconfig.json, abso.json, biome.json) runs the full check. 1616import { spawn, spawnSync } from "node:child_process"; 1717import { mkdirSync, readdirSync, readFileSync, statSync, writeFileSync } from "node:fs"; 18+import { createRequire } from "node:module"; 1819import { availableParallelism } from "node:os"; 1920import { dirname, extname, join, matchesGlob, relative, resolve, sep } from "node:path"; 2021import { fileURLToPath } from "node:url"; 21−import ts from "typescript";
2323const root = resolve(dirname(fileURLToPath(import.meta.url)), ".."); Lines 26–43 at 318 (were 26–37 at 97)
29− globs: ["src/**/*.test.ts", "worker/project/**/*.test.ts", "client/test/**/*.test.ts", "scripts/**/*.test.ts"],
31+ "worker/project/**/*.test.ts", 32+ "client/test/**/*.test.ts", 33+ "scripts/**/*.test.ts", 34+ "server/test/**/*.test.ts", 3036 args: ["--import", "./client/test/setup.ts"], 3339/** Typechecks: a tsconfig, from the repo root. */ 34−const TYPECHECKS = [{ tsconfig: "tsconfig.json" }];
40+const TYPECHECKS = [{ tsconfig: "tsconfig.json" }, { tsconfig: "server/tsconfig.json" }]; 3541/** Files whose change can reach anything: the full check runs instead. */ Lines 124–143 at 318 (were 118–123 at 97)
118124 return [...files].filter(Boolean); 128+ * A tsconfig's JSON. Plain JSON is read as it is; one with comments goes through TypeScript's reader, loaded 129+ * only then, since loading TypeScript takes seconds on a busy machine. 131+function readTsconfig(path) { 132+ const text = readFileSync(path, "utf8"); 134+ return JSON.parse(text); 136+ const ts = createRequire(join(root, "package.json"))("typescript"); 137+ return ts.parseConfigFileTextToJson(path, text).config ?? {}; 121141/** What the changed files reach: test files to run per test group, tsconfigs to check, files for biome. */ 122142export function plan(changed, files = allFiles()) { 123143 const known = new Set(files); Lines 166–172 at 318 (were 146–152 at 97)
146166 if (t) t.files.push(t.cwd === "." ? f : f.slice(t.cwd.length + 1)); 148168 const typechecks = TYPECHECKS.filter((c) => { 149− const cfg = ts.readConfigFile(join(root, c.tsconfig), (p) => readFileSync(p, "utf8")).config ?? {};
169+ const cfg = readTsconfig(join(root, c.tsconfig)); 150170 const dir = posix(dirname(c.tsconfig)); 151171 const inc = (cfg.include ?? ["**/*"]).map((g) => posix(join(dir, g))); 152172 const exc = (cfg.exclude ?? []).map((g) => posix(join(dir, g))); Lines 252–258 at 318 (were 232–238 at 97)
233253 for (const r of results) 234254 console.log(`${r.code === 0 ? "ok " : "FAIL"} ${(r.ms / 1000).toFixed(1).padStart(6)} s ${r.name}`); 235− console.log(`${((Date.now() - started) / 1000).toFixed(1)} s in all. The full check runs when you publish.`);
255+ console.log(`${((Date.now() - started) / 1000).toFixed(1)} s in all. The full check runs when you push.`); 236256 if (results.some((r) => r.code !== 0)) process.exitCode = 1;