Skip to content

Commit 8439734

Browse files
committed
test(jest): widen env base type to allow super(config, context) across CI types
1 parent 5b7c693 commit 8439734

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/testing/jest/jest-28/jest-environment.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@ import { connectBrowser, disconnectBrowser, newBrowserPage } from '../../puppete
66
import { JestPuppeteerEnvironmentConstructor } from '../jest-apis';
77

88
export function createJestPuppeteerEnvironment(): JestPuppeteerEnvironmentConstructor {
9-
const JestEnvironment = class extends NodeEnvironment {
9+
const BaseEnv = NodeEnvironment as unknown as new (...args: any[]) => any;
10+
const JestEnvironment = class extends BaseEnv {
1011
override global: JestGlobal.Global & JestEnvironmentGlobal;
1112
browser: any = null;
1213
pages: any[] = [];
1314
testPath: string | null = null;
1415

15-
constructor(config: any, context: any) {
16+
constructor(config: any, context?: any) {
1617
super(config, context);
1718
this.testPath = context?.testPath ?? null;
1819
}

src/testing/jest/jest-29/jest-environment.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@ import { connectBrowser, disconnectBrowser, newBrowserPage } from '../../puppete
66
import { JestPuppeteerEnvironmentConstructor } from '../jest-apis';
77

88
export function createJestPuppeteerEnvironment(): JestPuppeteerEnvironmentConstructor {
9-
const JestEnvironment = class extends NodeEnvironment {
9+
const BaseEnv = NodeEnvironment as unknown as new (...args: any[]) => any;
10+
const JestEnvironment = class extends BaseEnv {
1011
override global: JestGlobal.Global & JestEnvironmentGlobal;
1112
browser: any = null;
1213
pages: any[] = [];
1314
testPath: string | null = null;
1415

15-
constructor(config: any, context: any) {
16+
constructor(config: any, context?: any) {
1617
super(config, context);
1718
this.testPath = context?.testPath ?? null;
1819
}

0 commit comments

Comments
 (0)