@@ -105,6 +105,11 @@ export const SNAPSHOT_SCHEMA = 'test-leftovers-snapshot/1';
105105export const ROOT_GROUP = '(root)' ;
106106export const EXAMPLES_PER_PACKAGE = 5 ;
107107
108+ // The job log lists each package's paths in full up to this many, then says how
109+ // many more: one package that leaves thousands of files must not bury the rest.
110+ // `--json` always carries every path.
111+ export const LOG_PATHS_PER_PACKAGE = 50 ;
112+
108113// GitHub shows at most 10 warning annotations per step and drops the rest
109114// without saying so. Past that many packages the last slot becomes one roll-up
110115// annotation naming the rest, so no package is dropped silently; the job
@@ -369,7 +374,12 @@ export function renderSummary(report, { label, notes = [] }) {
369374 '' ,
370375 ) ;
371376 if ( report . packages . length === 0 ) {
372- lines . push ( `No path was added by the test run (${ report . added } new path(s) in all, none outside the rules below).` , '' ) ;
377+ lines . push (
378+ report . added === 0
379+ ? 'No path was added by the test run.'
380+ : `No path was added by the test run outside the rules below (${ report . added } new path(s), every one under a rule).` ,
381+ '' ,
382+ ) ;
373383 } else {
374384 lines . push ( `| package | paths added | examples (up to ${ EXAMPLES_PER_PACKAGE } ) |` , '| :-- | --: | :-- |' ) ;
375385 for ( const pkg of report . packages ) {
@@ -404,7 +414,8 @@ export function renderLog(report, { label }) {
404414 ) ;
405415 for ( const pkg of report . packages ) {
406416 lines . push ( ` ${ pkg . dir } ${ pkg . count } ` ) ;
407- for ( const path of pkg . paths ) lines . push ( ` ${ path } ` ) ;
417+ for ( const path of pkg . paths . slice ( 0 , LOG_PATHS_PER_PACKAGE ) ) lines . push ( ` ${ path } ` ) ;
418+ if ( pkg . count > LOG_PATHS_PER_PACKAGE ) lines . push ( ` ... and ${ pkg . count - LOG_PATHS_PER_PACKAGE } more under ${ pkg . dir } ` ) ;
408419 }
409420 }
410421 const excl = exclusionLines ( report ) ;
@@ -527,7 +538,7 @@ const SELF_TEST_BATTERIES = Object.freeze({
527538 '1. The diff: what counts as ADDED, and under which package' : 7 ,
528539 '2. The fixed exclusions: each one, and only its own paths' : 8 ,
529540 '3. turbo.json: the builds a test step runs after the snapshot' : 8 ,
530- '4. Rendering: the table, the annotations, the escaping' : 9 ,
541+ '4. Rendering: the table, the annotations, the escaping' : 10 ,
531542 '5. The real listing: ignored paths are seen (a real git tree)' : 5 ,
532543 '6. Never fails a job: the in-job modes exit 0 on every path' : 9 ,
533544} ) ;
@@ -678,6 +689,18 @@ function selfTest() {
678689 capped . length === ANNOTATIONS_PER_STEP && capped . at ( - 1 ) . includes ( '3 more package(s)' ) && capped . at ( - 1 ) . includes ( 'packages/p11 (1)' ) ,
679690 capped . join ( '\n' ) ,
680691 ) ;
692+ const flood = computeReport ( {
693+ before : [ ] ,
694+ after : Array . from ( { length : LOG_PATHS_PER_PACKAGE + 3 } , ( _ , i ) => `packages/runtime/.objectstack/f${ String ( i ) . padStart ( 3 , '0' ) } ` ) ,
695+ packageDirs : dirs ,
696+ } ) ;
697+ const logLines = renderLog ( flood , { label : 'L' } ) ;
698+ assert (
699+ `the log lists at most ${ LOG_PATHS_PER_PACKAGE } paths of a package and counts the rest` ,
700+ logLines . filter ( ( l ) => l . startsWith ( ' packages/runtime/' ) ) . length === LOG_PATHS_PER_PACKAGE &&
701+ logLines . some ( ( l ) => l . includes ( '... and 3 more under packages/runtime' ) ) ,
702+ logLines . slice ( - 3 ) . join ( '\n' ) ,
703+ ) ;
681704 assert ( 'an empty report raises no annotation' , renderAnnotations ( computeReport ( { before : [ ] , after : [ ] , packageDirs : dirs } ) , { label : 'L' } ) . length === 0 ) ;
682705 const md = renderSummary ( computeReport ( { before : [ ] , after : [ 'packages/runtime/a|b.json' ] , packageDirs : dirs } ) , { label : 'L' } ) ;
683706 assert ( 'the summary table escapes a pipe in a path' , md . includes ( '`packages/runtime/a\\|b.json`' ) , md ) ;
0 commit comments