@@ -256,35 +256,37 @@ versions.forEach((version) => {
256256 assert . notStrictEqual ( exitCode , 0 )
257257 } )
258258
259- it ( 'reports the session when a custom reporter throws during onExit' , async ( receiver , run ) => {
260- const proc = run (
261- './node_modules/.bin/playwright test -c playwright.config.js' ,
262- {
263- cwd,
264- env : {
265- ...getCiVisAgentlessConfig ( receiver . port ) ,
266- PW_BASE_URL : `http://localhost:${ webAppPort } ` ,
267- PLAYWRIGHT_THROWING_REPORTER : '1' ,
268- PLAYWRIGHT_REPORTER_THROWS_ON_EXIT : '1' ,
269- TEST_DIR : REQUEST_ERROR_TAG_TEST_DIR ,
270- } ,
271- }
272- )
273- const eventsPromise = receiver . gatherPayloadsUntilChildExit (
274- proc ,
275- ( { url } ) => url . endsWith ( '/api/v2/citestcycle' ) ,
276- ( payloads ) => {
277- const events = payloads . flatMap ( ( { payload } ) => payload . events )
278- for ( const eventType of [ 'test_session_end' , 'test_module_end' , 'test_suite_end' ] ) {
279- const event = events . find ( event => event . type === eventType )
280- assert . ok ( event , `expected ${ eventType } event` )
281- assert . strictEqual ( event . content . meta [ TEST_STATUS ] , 'fail' )
282- assert . match ( event . content . meta [ ERROR_MESSAGE ] , / c u s t o m P l a y w r i g h t r e p o r t e r o n E x i t f a i l e d / )
259+ contextNewVersions ( 'reporter onExit' , ( ) => {
260+ it ( 'reports the session when a custom reporter throws during onExit' , async ( receiver , run ) => {
261+ const proc = run (
262+ './node_modules/.bin/playwright test -c playwright.config.js' ,
263+ {
264+ cwd,
265+ env : {
266+ ...getCiVisAgentlessConfig ( receiver . port ) ,
267+ PW_BASE_URL : `http://localhost:${ webAppPort } ` ,
268+ PLAYWRIGHT_THROWING_REPORTER : '1' ,
269+ PLAYWRIGHT_REPORTER_THROWS_ON_EXIT : '1' ,
270+ TEST_DIR : REQUEST_ERROR_TAG_TEST_DIR ,
271+ } ,
283272 }
284- }
285- )
286- const [ [ exitCode ] ] = await Promise . all ( [ once ( proc , 'exit' ) , eventsPromise ] )
287- assert . notStrictEqual ( exitCode , 0 )
273+ )
274+ const eventsPromise = receiver . gatherPayloadsUntilChildExit (
275+ proc ,
276+ ( { url } ) => url . endsWith ( '/api/v2/citestcycle' ) ,
277+ ( payloads ) => {
278+ const events = payloads . flatMap ( ( { payload } ) => payload . events )
279+ for ( const eventType of [ 'test_session_end' , 'test_module_end' , 'test_suite_end' ] ) {
280+ const event = events . find ( event => event . type === eventType )
281+ assert . ok ( event , `expected ${ eventType } event` )
282+ assert . strictEqual ( event . content . meta [ TEST_STATUS ] , 'fail' )
283+ assert . match ( event . content . meta [ ERROR_MESSAGE ] , / c u s t o m P l a y w r i g h t r e p o r t e r o n E x i t f a i l e d / )
284+ }
285+ }
286+ )
287+ const [ [ exitCode ] ] = await Promise . all ( [ once ( proc , 'exit' ) , eventsPromise ] )
288+ assert . notStrictEqual ( exitCode , 0 )
289+ } )
288290 } )
289291
290292 it ( 'does not replace reporter errors with a custom stack formatter' , async ( receiver , run ) => {
0 commit comments