This repository was archived by the owner on Sep 11, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change 22/* eslint-disable @typescript-eslint/ban-ts-ignore */
33import NodeEnvironment from 'jest-environment-node'
44import { Config as JestConfig } from '@jest/types'
5+ import { Event , State } from 'jest-circus'
56import {
67 getBrowserType ,
78 getDeviceType ,
@@ -177,6 +178,18 @@ class PlaywrightEnvironment extends NodeEnvironment {
177178 }
178179 }
179180
181+ async handleTestEvent ( event : Event , state : State ) : Promise < void > {
182+ // Hack to set testTimeout for jestPlaywright debugging
183+ if (
184+ event . name === 'add_test' &&
185+ event . fn &&
186+ event . fn . toString ( ) . includes ( 'jestPlaywright.debug()' )
187+ ) {
188+ // Set timeout to 4 days
189+ state . testTimeout = 4 * 24 * 60 * 60 * 1000
190+ }
191+ }
192+
180193 async teardown ( jestConfig : JestConfig . InitialOptions = { } ) : Promise < void > {
181194 const { page, context, browser } = this . global
182195 if ( page ) {
Original file line number Diff line number Diff line change @@ -66,7 +66,10 @@ class PlaywrightRunner extends JestRunner {
6666 globalConfig : JestConfig . GlobalConfig ,
6767 context : TestRunnerContext ,
6868 ) {
69- super ( globalConfig , context )
69+ const config = { ...globalConfig }
70+ // Set default timeout to 15s
71+ config . testTimeout = config . testTimeout || 15000
72+ super ( config , context )
7073 }
7174
7275 async runTests (
You can’t perform that action at this time.
0 commit comments