@@ -244,8 +244,7 @@ export function processEventForTestDebugging(
244244 if ( event !== 'SettingAccess' && event !== 'FunctionCall' ) {
245245 lastImpressionLogEntry = null ;
246246 }
247- maybeLogDebugEvent (
248- { interaction : `${ event } : ${ veTestKeys . get ( state ?. veid || 0 ) || ( state ?. veid ? '<UNKNOWN>' : '' ) } ` } ) ;
247+ maybeLogDebugEvent ( { interaction : event , veid : state ?. veid || 0 } ) ;
249248 checkPendingEventExpectation ( ) ;
250249}
251250
@@ -312,6 +311,7 @@ type TestLogEntry = {
312311 impressions : string [ ] ,
313312} | {
314313 interaction : string ,
314+ veid ?: number ,
315315} ;
316316
317317export function processImpressionsForDebugging ( states : LoggingState [ ] ) : void {
@@ -715,7 +715,8 @@ export function processStartLoggingForDebugging(): void {
715715// Interaction events need to match exactly.
716716function compareVeEvents ( actual : TestLogEntry , expected : TestLogEntry ) : boolean {
717717 if ( 'interaction' in expected && 'interaction' in actual ) {
718- return expected . interaction === actual . interaction ;
718+ const actualString = formatInteraction ( actual ) ;
719+ return expected . interaction === actualString ;
719720 }
720721 if ( 'impressions' in expected && 'impressions' in actual ) {
721722 const actualSet = new Set ( actual . impressions ) ;
@@ -755,8 +756,26 @@ function formatImpressions(impressions: string[]): string {
755756
756757const EVENT_EXPECTATION_TIMEOUT = 5000 ;
757758
759+ function formatInteraction ( e : TestLogEntry ) : string {
760+ if ( 'interaction' in e ) {
761+ if ( e . veid !== undefined ) {
762+ const key = veTestKeys . get ( e . veid ) || ( e . veid ? '<UNKNOWN>' : '' ) ;
763+ return `${ e . interaction } : ${ key } ` ;
764+ }
765+ return e . interaction ;
766+ }
767+ return '' ;
768+ }
769+
758770function formatVeEvents ( events : TestLogEntry [ ] ) : string {
759- return events . map ( e => 'interaction' in e ? e . interaction : formatImpressions ( e . impressions ) ) . join ( '\n' ) ;
771+ return events
772+ . map ( e => {
773+ if ( 'interaction' in e ) {
774+ return formatInteraction ( e ) ;
775+ }
776+ return formatImpressions ( e . impressions ) ;
777+ } )
778+ . join ( '\n' ) ;
760779}
761780
762781// Verifies that VE events contains all the expected events in given order.
@@ -832,9 +851,7 @@ function checkPendingEventExpectation(): void {
832851
833852function getUnmatchedVeEvents ( ) : string {
834853 console . error ( numMatchedEvents ) ;
835- return ( veDebugEventsLog . slice ( numMatchedEvents ) as TestLogEntry [ ] )
836- . map ( e => 'interaction' in e ? e . interaction : formatImpressions ( e . impressions ) )
837- . join ( '\n' ) ;
854+ return formatVeEvents ( veDebugEventsLog . slice ( numMatchedEvents ) as TestLogEntry [ ] ) ;
838855}
839856
840857// @ts -expect-error
0 commit comments