Skip to content

Commit 5b7c693

Browse files
committed
test(jest): call super(config, context) as first statement in env ctors
1 parent 2506a46 commit 5b7c693

File tree

2 files changed

+4
-18
lines changed

2 files changed

+4
-18
lines changed

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

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,8 @@ export function createJestPuppeteerEnvironment(): JestPuppeteerEnvironmentConstr
1212
pages: any[] = [];
1313
testPath: string | null = null;
1414

15-
constructor(...args: any[]) {
16-
// Support both (config) and (config, context) jest env ctors without spread typing issues
17-
const config = args[0];
18-
const context = args[1];
19-
if (args.length >= 2) {
20-
super(config, context);
21-
} else {
22-
super(config);
23-
}
15+
constructor(config: any, context: any) {
16+
super(config, context);
2417
this.testPath = context?.testPath ?? null;
2518
}
2619

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

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,8 @@ export function createJestPuppeteerEnvironment(): JestPuppeteerEnvironmentConstr
1212
pages: any[] = [];
1313
testPath: string | null = null;
1414

15-
constructor(...args: any[]) {
16-
// Support both (config) and (config, context) jest env ctors without spread typing issues
17-
const config = args[0];
18-
const context = args[1];
19-
if (args.length >= 2) {
20-
super(config, context);
21-
} else {
22-
super(config);
23-
}
15+
constructor(config: any, context: any) {
16+
super(config, context);
2417
this.testPath = context?.testPath ?? null;
2518
}
2619

0 commit comments

Comments
 (0)