@@ -36,6 +36,10 @@ describe('BrowserConsole', () => {
3636 index : 0 ,
3737 _getSpan : ( ) => undefined ,
3838 } ;
39+ const getCurrentStepNameAndIndex = ( ) => {
40+ const { name, index } = currentStep ;
41+ return { name, index } ;
42+ } ;
3943 beforeAll ( async ( ) => {
4044 server = await Server . create ( ) ;
4145 } ) ;
@@ -69,7 +73,7 @@ describe('BrowserConsole', () => {
6973 expect ( warnMessage ?. text ) . toEqual ( 'console.warn' ) ;
7074 expect ( warnMessage ?. type ) . toEqual ( 'warning' ) ;
7175 expect ( warnMessage ?. timestamp ) . toBeDefined ( ) ;
72- expect ( warnMessage ?. step ) . toEqual ( currentStep ) ;
76+ expect ( warnMessage ?. step ) . toEqual ( getCurrentStepNameAndIndex ( ) ) ;
7377 expect ( messages . slice ( 1 ) . map ( m => m . text ) ) . toEqual ( [
7478 'console.error' ,
7579 'console.error popup' ,
@@ -97,13 +101,13 @@ describe('BrowserConsole', () => {
97101 `Failed to load resource: the server responded with a status of 404 (Not Found)`
98102 ) ;
99103 expect ( notFoundMessage ?. type ) . toEqual ( 'error' ) ;
100- expect ( notFoundMessage ?. step ) . toEqual ( currentStep ) ;
104+ expect ( notFoundMessage ?. step ) . toEqual ( getCurrentStepNameAndIndex ( ) ) ;
101105
102106 const referenceError = messages . find (
103107 m => m . text . indexOf ( 'that is not defined' ) >= 0
104108 ) ;
105109 expect ( referenceError ?. type ) . toEqual ( 'error' ) ;
106- expect ( referenceError ?. step ) . toEqual ( currentStep ) ;
110+ expect ( referenceError ?. step ) . toEqual ( getCurrentStepNameAndIndex ( ) ) ;
107111 } ) ;
108112
109113 it ( 'capture unhandled rejections on all pages' , async ( ) => {
@@ -134,7 +138,7 @@ describe('BrowserConsole', () => {
134138 expect ( messages . length ) . toEqual ( 2 ) ;
135139 const [ page1Err , page2Err ] = messages ;
136140 expect ( page1Err ?. type ) . toEqual ( 'error' ) ;
137- expect ( page1Err ?. step ) . toEqual ( currentStep ) ;
141+ expect ( page1Err ?. step ) . toEqual ( getCurrentStepNameAndIndex ( ) ) ;
138142 expect ( page2Err ?. text ) . toEqual ( 'popup error' ) ;
139143 } ) ;
140144
0 commit comments