@@ -362,12 +362,34 @@ describe("scan coverage floor", () => {
362362// scripts/ tree, the real guard runs as a subprocess, and the run must exit
363363// nonzero naming the probe. The probe lives only for the test (never
364364// committed) so the keep-alive check cannot itself become a dead export.
365+ //
366+ // The guard normally scans the full project via ts-prune (~5s); the probe's
367+ // temp tsconfig includes only the probe file, so this run pays only ts-prune
368+ // startup while still exercising the same wired-up gate (config load,
369+ // allowlist validation, node-spawned ts-prune, output parsing, coverage
370+ // floor, exit code).
365371describe ( "violation end to end" , ( ) => {
366372 test ( "a temp dead export fails the guard, which names it" , ( ) => {
367373 const probeFile = `dead-export-guard-probe-${ process . pid } .ts` ;
368374 const probeName = `deadExportGuardProbe${ process . pid } ` ;
369375 const probePath = join ( repoRoot , "scripts" , probeFile ) ;
376+ const narrowTsconfigFile = `dead-export-guard-tsconfig-${ process . pid } .json` ;
377+ const narrowTsconfigPath = join ( repoRoot , "scripts" , narrowTsconfigFile ) ;
370378 writeFileSync ( probePath , `export const ${ probeName } = 1;\n` ) ;
379+ writeFileSync (
380+ narrowTsconfigPath ,
381+ JSON . stringify ( {
382+ compilerOptions : {
383+ noEmit : true ,
384+ target : "ESNext" ,
385+ module : "ESNext" ,
386+ moduleResolution : "bundler" ,
387+ skipLibCheck : true ,
388+ } ,
389+ // Relative to the narrow tsconfig's own directory (scripts/).
390+ files : [ probeFile ] ,
391+ } ) ,
392+ ) ;
371393 try {
372394 const ran = spawnSync (
373395 process . execPath ,
@@ -381,6 +403,7 @@ describe("violation end to end", () => {
381403 env : {
382404 ...process . env ,
383405 DEAD_EXPORT_GUARD_SCANNED_FILES : String ( liveScannedFileCount ( ) ) ,
406+ DEAD_EXPORT_GUARD_TSCONFIG : `scripts/${ narrowTsconfigFile } ` ,
384407 } ,
385408 } ,
386409 ) ;
@@ -390,6 +413,7 @@ describe("violation end to end", () => {
390413 ) ;
391414 } finally {
392415 rmSync ( probePath , { force : true } ) ;
416+ rmSync ( narrowTsconfigPath , { force : true } ) ;
393417 }
394418 } , 120_000 ) ;
395419} ) ;
0 commit comments