fix CI: stop fixture programs parsing the default lib (spec timeouts)
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.
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user