File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -76,15 +76,15 @@ export class PageCollector<T> {
7676 async init ( ) {
7777 const pages = await this . #browser. pages ( this . #includeAllPages) ;
7878 for ( const page of pages ) {
79- await this . addPage ( page ) ;
79+ this . addPage ( page ) ;
8080 }
8181
8282 this . #browser. on ( 'targetcreated' , async target => {
8383 const page = await target . page ( ) ;
8484 if ( ! page ) {
8585 return ;
8686 }
87- await this . addPage ( page ) ;
87+ this . addPage ( page ) ;
8888 } ) ;
8989 this . #browser. on ( 'targetdestroyed' , async target => {
9090 const page = await target . page ( ) ;
@@ -245,7 +245,10 @@ export class ConsoleCollector extends PageCollector<
245245 data . issue satisfies Protocol . Audits . InspectorIssue ;
246246 // @ts -expect-error Types of protocol from Puppeteer and CDP are incomparable for InspectorIssueCode, one is union, other is enum
247247 const issue = createIssuesFromProtocolIssue ( null , inspectorIssue ) [ 0 ] ;
248- if ( ! issue ) return ;
248+ if ( ! issue ) {
249+ logger ( 'No issue mapping for for the issue: ' , inspectorIssue . code ) ;
250+ return ;
251+ }
249252
250253 const seenKeys = this . #seenIssueKeys. get ( page ) ! ;
251254 const primaryKey = issue . primaryKey ( ) ;
Original file line number Diff line number Diff line change @@ -429,7 +429,9 @@ describe('ConsoleCollector', () => {
429429
430430 cdpSession . emit ( 'Audits.issueAdded' , { issue} ) ;
431431 cdpSession . emit ( 'Audits.issueAdded' , { issue} ) ;
432- const collectedIssue = collector . getData ( page ) [ 0 ] ;
432+ const data = collector . getData ( page ) ;
433+ assert . equal ( data . length , 1 ) ;
434+ const collectedIssue = data [ 0 ] ;
433435 assert ( collectedIssue instanceof AggregatedIssue ) ;
434436 assert . equal ( collectedIssue . code ( ) , 'MixedContentIssue' ) ;
435437 assert . equal ( collectedIssue . getAggregatedIssuesCount ( ) , 1 ) ;
You can’t perform that action at this time.
0 commit comments