@@ -10,13 +10,16 @@ import {describe, it} from 'node:test';
1010import { SymbolizedError } from '../../src/DevtoolsUtils.js' ;
1111import { ConsoleFormatter } from '../../src/formatters/ConsoleFormatter.js' ;
1212import { UncaughtError } from '../../src/PageCollector.js' ;
13- import type { ConsoleMessage } from '../../src/third_party/index.js' ;
13+ import type { ConsoleMessage , Protocol } from '../../src/third_party/index.js' ;
1414import type { DevTools } from '../../src/third_party/index.js' ;
1515
1616interface MockConsoleMessage {
1717 type : ( ) => string ;
1818 text : ( ) => string ;
19- args : ( ) => Array < { jsonValue : ( ) => Promise < unknown > } > ;
19+ args : ( ) => Array < {
20+ jsonValue : ( ) => Promise < unknown > ;
21+ remoteObject : ( ) => Protocol . Runtime . RemoteObject ;
22+ } > ;
2023 stackTrace ?: DevTools . StackTrace . StackTrace . StackTrace ;
2124}
2225
@@ -46,7 +49,12 @@ describe('ConsoleFormatter', () => {
4649 const message = createMockMessage ( {
4750 type : ( ) => 'log' ,
4851 text : ( ) => 'Processing file:' ,
49- args : ( ) => [ { jsonValue : async ( ) => 'file.txt' } ] ,
52+ args : ( ) => [
53+ {
54+ jsonValue : async ( ) => 'file.txt' ,
55+ remoteObject : ( ) => ( { type : 'string' } ) ,
56+ } ,
57+ ] ,
5058 } ) ;
5159 const result = (
5260 await ConsoleFormatter . from ( message , { id : 2 , fetchDetailedData : true } )
@@ -59,8 +67,14 @@ describe('ConsoleFormatter', () => {
5967 type : ( ) => 'log' ,
6068 text : ( ) => 'Processing file:' ,
6169 args : ( ) => [
62- { jsonValue : async ( ) => 'file.txt' } ,
63- { jsonValue : async ( ) => 'another file' } ,
70+ {
71+ jsonValue : async ( ) => 'file.txt' ,
72+ remoteObject : ( ) => ( { type : 'string' } ) ,
73+ } ,
74+ {
75+ jsonValue : async ( ) => 'another file' ,
76+ remoteObject : ( ) => ( { type : 'string' } ) ,
77+ } ,
6478 ] ,
6579 } ) ;
6680 const result = (
@@ -106,7 +120,12 @@ describe('ConsoleFormatter', () => {
106120 const message = createMockMessage ( {
107121 type : ( ) => 'log' ,
108122 text : ( ) => 'Processing file:' ,
109- args : ( ) => [ { jsonValue : async ( ) => 'file.txt' } ] ,
123+ args : ( ) => [
124+ {
125+ jsonValue : async ( ) => 'file.txt' ,
126+ remoteObject : ( ) => ( { type : 'string' } ) ,
127+ } ,
128+ ] ,
110129 } ) ;
111130 const result = (
112131 await ConsoleFormatter . from ( message , { id : 2 , fetchDetailedData : true } )
@@ -119,8 +138,14 @@ describe('ConsoleFormatter', () => {
119138 type : ( ) => 'log' ,
120139 text : ( ) => 'Processing file:' ,
121140 args : ( ) => [
122- { jsonValue : async ( ) => 'file.txt' } ,
123- { jsonValue : async ( ) => 'another file' } ,
141+ {
142+ jsonValue : async ( ) => 'file.txt' ,
143+ remoteObject : ( ) => ( { type : 'string' } ) ,
144+ } ,
145+ {
146+ jsonValue : async ( ) => 'another file' ,
147+ remoteObject : ( ) => ( { type : 'string' } ) ,
148+ } ,
124149 ] ,
125150 } ) ;
126151 const result = (
@@ -195,6 +220,7 @@ describe('ConsoleFormatter', () => {
195220 jsonValue : async ( ) => {
196221 throw new Error ( 'Execution context is not available' ) ;
197222 } ,
223+ remoteObject : ( ) => ( { type : 'string' } ) ,
198224 } ,
199225 ] ,
200226 } ) ;
@@ -320,8 +346,14 @@ describe('ConsoleFormatter', () => {
320346 type : ( ) => 'log' ,
321347 text : ( ) => 'Processing file:' ,
322348 args : ( ) => [
323- { jsonValue : async ( ) => 'file.txt' } ,
324- { jsonValue : async ( ) => 'another file' } ,
349+ {
350+ jsonValue : async ( ) => 'file.txt' ,
351+ remoteObject : ( ) => ( { type : 'string' } ) ,
352+ } ,
353+ {
354+ jsonValue : async ( ) => 'another file' ,
355+ remoteObject : ( ) => ( { type : 'string' } ) ,
356+ } ,
325357 ] ,
326358 } ) ;
327359 const result = ( await ConsoleFormatter . from ( message , { id : 1 } ) ) . toJSON ( ) ;
@@ -357,8 +389,14 @@ describe('ConsoleFormatter', () => {
357389 type : ( ) => 'log' ,
358390 text : ( ) => 'Processing file:' ,
359391 args : ( ) => [
360- { jsonValue : async ( ) => 'file.txt' } ,
361- { jsonValue : async ( ) => 'another file' } ,
392+ {
393+ jsonValue : async ( ) => 'file.txt' ,
394+ remoteObject : ( ) => ( { type : 'string' } ) ,
395+ } ,
396+ {
397+ jsonValue : async ( ) => 'another file' ,
398+ remoteObject : ( ) => ( { type : 'string' } ) ,
399+ } ,
362400 ] ,
363401 } ) ;
364402 const result = (
0 commit comments