@@ -459,6 +459,10 @@ describe('trueAffected', () => {
459459 filePath : 'proj1/index.ts' ,
460460 changedLines : [ 2 ] ,
461461 } ,
462+ {
463+ filePath : 'proj2/index.ts' ,
464+ changedLines : [ 6 ] ,
465+ } ,
462466 ] ;
463467 jest . spyOn ( git , 'getChangedFiles' ) . mockReturnValue ( changedFiles ) ;
464468
@@ -512,10 +516,26 @@ describe('trueAffected', () => {
512516 `Added package proj1 to affected packages for changed line ${ changedFiles [ 0 ] . changedLines [ 0 ] } in ${ changedFiles [ 0 ] . filePath } `
513517 ) ;
514518 expect ( debug ) . toHaveBeenCalledWith (
515- expect . stringMatching (
516- new RegExp ( `^Found identifier .* in .*${ changedFiles [ 0 ] . filePath } $` )
517- )
519+ `Added package proj2 to affected packages for changed line ${ changedFiles [ 1 ] . changedLines [ 0 ] } in ${ changedFiles [ 1 ] . filePath } `
520+ ) ;
521+
522+ const project1VisitingLogs = debug . mock . calls . filter (
523+ ( [ arg ] ) => expect . stringMatching (
524+ new RegExp ( `^Visiting .* in .*${ changedFiles [ 0 ] . filePath } $` )
525+ ) . asymmetricMatch ( arg )
518526 ) ;
527+
528+ expect ( project1VisitingLogs ) . toHaveLength ( 1 ) ;
529+
530+ const project2VisitingLogs = debug . mock . calls . filter (
531+ ( [ arg ] ) => expect . stringMatching (
532+ new RegExp ( `^Visiting .* in .*${ changedFiles [ 1 ] . filePath } $` )
533+ ) . asymmetricMatch ( arg )
534+ ) ;
535+ // would have duplicates if visited multiple times
536+ const uniqueProject2VisitingLogs = new Set ( project2VisitingLogs . map ( ( [ arg ] ) => arg ) ) ;
537+ expect ( uniqueProject2VisitingLogs . size ) . toBe ( project2VisitingLogs . length ) ;
538+
519539 expect ( debug ) . toHaveBeenCalledWith (
520540 'Added package proj2 to affected packages'
521541 ) ;
0 commit comments