Skip to content

Fix testTimeout for helper jestConfig #773

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/PlaywrightRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ const getBrowserTest = ({
browser,
wsEndpoint,
device,
testTimeout,
}: BrowserTest): JestPlaywrightTest => {
const { displayName, testEnvironmentOptions } = test.context.config
const playwrightDisplayName = getDisplayName(
Expand All @@ -62,7 +63,7 @@ const getBrowserTest = ({
...test.context.config,
testEnvironmentOptions: {
...testEnvironmentOptions,
[CONFIG_ENVIRONMENT_NAME]: config,
[CONFIG_ENVIRONMENT_NAME]: { ...config, testTimeout },
},
browserName: browser,
wsEndpoint,
Expand Down Expand Up @@ -170,6 +171,7 @@ class PlaywrightRunner extends JestRunner {
config: browserConfig,
wsEndpoint,
browser: browserType,
testTimeout: this.config.testTimeout,
}

if (resultDevices.length) {
Expand Down
6 changes: 4 additions & 2 deletions src/extends.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* eslint-disable @typescript-eslint/no-explicit-any*/
import { getSkipFlag, deepMerge } from './utils'
import { SkipOption, TestPlaywrightConfigOptions } from '../types/global'
import { DEBUG_TIMEOUT, DEFAULT_TEST_PLAYWRIGHT_TIMEOUT } from './constants'
import { CONFIG_ENVIRONMENT_NAME, DEBUG_TIMEOUT } from './constants'

type TestType = 'it' | 'describe'

Expand Down Expand Up @@ -57,7 +57,9 @@ const runConfigTest = (
) => {
const lastArg = args[args.length - 1]
const timer =
typeof lastArg === 'number' ? lastArg : DEFAULT_TEST_PLAYWRIGHT_TIMEOUT
typeof lastArg === 'number'
? lastArg
: (global as any)[CONFIG_ENVIRONMENT_NAME].testTimeout
jestTypeTest(
args[0],
async () => {
Expand Down
1 change: 1 addition & 0 deletions types/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ export interface BrowserTest {
browser: BrowserType
wsEndpoint: WsEndpointType
device: DeviceType
testTimeout?: number
}

export type ConfigParams = {
Expand Down