From 3c572cf70a09a00caf05262c964085cca4bfac87 Mon Sep 17 00:00:00 2001 From: Tianyi Cui <53024+tianyicui@users.noreply.github.com> Date: Tue, 7 Jul 2026 16:22:43 +0800 Subject: [PATCH] fix CI: stop fixture programs parsing the default lib (spec timeouts) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The coverage CI lane timed out (5000ms/test) in verify-export-jsdoc.spec.ts: every test builds a ts.Program, and the fixture branch of loadCompilerOptions omitted noLib, so each of the 34 tests parsed the full default lib — measured 231ms/program bare, ~1.5s/test under coverage instrumentation locally, past 5s on a 2-core runner. Fixtures are self-contained and nothing in the walk resolves a lib symbol: noLib + types:[] drops program creation to ~1ms and the spec's coverage-mode test time from 53s to 0.16s. The real-repo branch (tsconfig.base.json options) is untouched. --- scripts/verify-export-jsdoc.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/verify-export-jsdoc.ts b/scripts/verify-export-jsdoc.ts index a2d8a82f97..3845d60f1b 100644 --- a/scripts/verify-export-jsdoc.ts +++ b/scripts/verify-export-jsdoc.ts @@ -510,15 +510,17 @@ function checkScope(statements: readonly ts.Statement[], prefix: string, w: Walk * Compiler options for the walk's program. The real repo hands over its * tsconfig.base.json (whose `paths` map resolves cross-package imports to * source, so heritage-member lookups see seam types); a fixture root without - * one gets bare defaults — fixtures are single-file and self-contained. - * Emit-side options are stripped: the walk never emits or asks for - * diagnostics, it only binds types on demand. + * one gets `noLib` + no `@types` — fixtures are single-file and + * self-contained, nothing in the walk resolves a lib symbol, and default-lib + * parsing is ~99% of per-program cost (it made the fixture spec time out + * under CI coverage instrumentation). Emit-side options are stripped: the + * walk never emits or asks for diagnostics, it only binds types on demand. * @param scanRoot - the root being scanned. * @returns compiler options for ts.createProgram. */ function loadCompilerOptions(scanRoot: string): ts.CompilerOptions { const cfgPath = resolve(scanRoot, 'tsconfig.base.json') - if (!existsSync(cfgPath)) return { skipLibCheck: true } + if (!existsSync(cfgPath)) return { skipLibCheck: true, noLib: true, types: [] } const cfg = ts.readConfigFile(cfgPath, ts.sys.readFile.bind(ts.sys)) as { config?: unknown } const parsed = ts.parseJsonConfigFileContent(cfg.config ?? {}, ts.sys, scanRoot) return {