@@ -385,6 +385,37 @@ describe('ConsoleCollector', () => {
385385 assert . equal ( data . length , 2 ) ;
386386 } ) ;
387387
388+ it ( 'silently ignores unmapped PerformanceIssue events' , async ( ) => {
389+ const browser = getMockBrowser ( ) ;
390+ const page = ( await browser . pages ( ) ) [ 0 ] ;
391+ // @ts -expect-error internal API.
392+ const cdpSession = page . _client ( ) ;
393+ const warnStub = sinon . stub ( console , 'warn' ) ;
394+
395+ const collector = new ConsoleCollector ( browser , collect => {
396+ return {
397+ issue : issue => {
398+ collect ( issue as DevTools . AggregatedIssue ) ;
399+ } ,
400+ } as ListenerMap ;
401+ } ) ;
402+ await collector . init ( [ page ] ) ;
403+
404+ const performanceIssue = {
405+ code : 'PerformanceIssue' ,
406+ details : {
407+ performanceIssueDetails : {
408+ performanceIssueType : 'DocumentCookie' ,
409+ } ,
410+ } ,
411+ } as unknown as Protocol . Audits . InspectorIssue ;
412+
413+ cdpSession . emit ( 'Audits.issueAdded' , { issue : performanceIssue } ) ;
414+
415+ assert . equal ( collector . getData ( page ) . length , 0 ) ;
416+ sinon . assert . notCalled ( warnStub ) ;
417+ } ) ;
418+
388419 it ( 'filters duplicated issues' , async ( ) => {
389420 const browser = getMockBrowser ( ) ;
390421 const page = ( await browser . pages ( ) ) [ 0 ] ;
0 commit comments