Skip to content

Commit 9ffba61

Browse files
committed
define test function as early as possible
1 parent 2b60fe6 commit 9ffba61

File tree

4 files changed

+24
-24
lines changed

4 files changed

+24
-24
lines changed

src/csf/__snapshots__/transformCsf.test.ts.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ if (!require.main) {
2929
if (globalThis.__sbPreVisit) {
3030
await globalThis.__sbPreVisit(page, context);
3131
}
32-
const result = await page.evaluate(({
32+
const result = await page.addInitScript(({
3333
id,
3434
hasPlayFn
3535
}) => __test(id, hasPlayFn), {
@@ -96,7 +96,7 @@ if (!require.main) {
9696
if (globalThis.__sbPreVisit) {
9797
await globalThis.__sbPreVisit(page, context);
9898
}
99-
const result = await page.evaluate(({
99+
const result = await page.addInitScript(({
100100
id,
101101
hasPlayFn
102102
}) => __test(id, hasPlayFn), {
@@ -149,7 +149,7 @@ if (!require.main) {
149149
if (globalThis.__sbPreVisit) {
150150
await globalThis.__sbPreVisit(page, context);
151151
}
152-
const result = await page.evaluate(({
152+
const result = await page.addInitScript(({
153153
id,
154154
hasPlayFn
155155
}) => __test(id, hasPlayFn), {

src/playwright/transformPlaywright.test.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ describe('Playwright', () => {
6969
if (globalThis.__sbPreVisit) {
7070
await globalThis.__sbPreVisit(page, context);
7171
}
72-
const result = await page.evaluate(({
72+
const result = await page.addInitScript(({
7373
id,
7474
hasPlayFn
7575
}) => __test(id, hasPlayFn), {
@@ -114,7 +114,7 @@ describe('Playwright', () => {
114114
if (globalThis.__sbPreVisit) {
115115
await globalThis.__sbPreVisit(page, context);
116116
}
117-
const result = await page.evaluate(({
117+
const result = await page.addInitScript(({
118118
id,
119119
hasPlayFn
120120
}) => __test(id, hasPlayFn), {
@@ -177,7 +177,7 @@ describe('Playwright', () => {
177177
if (globalThis.__sbPreVisit) {
178178
await globalThis.__sbPreVisit(page, context);
179179
}
180-
const result = await page.evaluate(({
180+
const result = await page.addInitScript(({
181181
id,
182182
hasPlayFn
183183
}) => __test(id, hasPlayFn), {
@@ -240,7 +240,7 @@ describe('Playwright', () => {
240240
if (globalThis.__sbPreVisit) {
241241
await globalThis.__sbPreVisit(page, context);
242242
}
243-
const result = await page.evaluate(({
243+
const result = await page.addInitScript(({
244244
id,
245245
hasPlayFn
246246
}) => __test(id, hasPlayFn), {
@@ -285,7 +285,7 @@ describe('Playwright', () => {
285285
if (globalThis.__sbPreVisit) {
286286
await globalThis.__sbPreVisit(page, context);
287287
}
288-
const result = await page.evaluate(({
288+
const result = await page.addInitScript(({
289289
id,
290290
hasPlayFn
291291
}) => __test(id, hasPlayFn), {
@@ -357,7 +357,7 @@ describe('Playwright', () => {
357357
if (globalThis.__sbPreVisit) {
358358
await globalThis.__sbPreVisit(page, context);
359359
}
360-
const result = await page.evaluate(({
360+
const result = await page.addInitScript(({
361361
id,
362362
hasPlayFn
363363
}) => __test(id, hasPlayFn), {
@@ -402,7 +402,7 @@ describe('Playwright', () => {
402402
if (globalThis.__sbPreVisit) {
403403
await globalThis.__sbPreVisit(page, context);
404404
}
405-
const result = await page.evaluate(({
405+
const result = await page.addInitScript(({
406406
id,
407407
hasPlayFn
408408
}) => __test(id, hasPlayFn), {
@@ -479,7 +479,7 @@ describe('Playwright', () => {
479479
if (globalThis.__sbPreVisit) {
480480
await globalThis.__sbPreVisit(page, context);
481481
}
482-
const result = await page.evaluate(({
482+
const result = await page.addInitScript(({
483483
id,
484484
hasPlayFn
485485
}) => __test(id, hasPlayFn), {
@@ -540,7 +540,7 @@ describe('Playwright', () => {
540540
if (globalThis.__sbPreVisit) {
541541
await globalThis.__sbPreVisit(page, context);
542542
}
543-
const result = await page.evaluate(({
543+
const result = await page.addInitScript(({
544544
id,
545545
hasPlayFn
546546
}) => __test(id, hasPlayFn), {
@@ -601,7 +601,7 @@ describe('Playwright', () => {
601601
if (globalThis.__sbPreVisit) {
602602
await globalThis.__sbPreVisit(page, context);
603603
}
604-
const result = await page.evaluate(({
604+
const result = await page.addInitScript(({
605605
id,
606606
hasPlayFn
607607
}) => __test(id, hasPlayFn), {

src/playwright/transformPlaywright.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const testPrefixer: TestPrefixer = (context) => {
2525
await globalThis.__sbPreVisit(page, context);
2626
}
2727
28-
const result = await page.evaluate(({ id, hasPlayFn }) => __test(id, hasPlayFn), {
28+
const result = await page.addInitScript(({ id, hasPlayFn }) => __test(id, hasPlayFn), {
2929
id: %%id%%,
3030
});
3131

src/playwright/transformPlaywrightJson.test.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ describe('Playwright Json', () => {
5353
if (globalThis.__sbPreVisit) {
5454
await globalThis.__sbPreVisit(page, context);
5555
}
56-
const result = await page.evaluate(({
56+
const result = await page.addInitScript(({
5757
id,
5858
hasPlayFn
5959
}) => __test(id, hasPlayFn), {
@@ -98,7 +98,7 @@ describe('Playwright Json', () => {
9898
if (globalThis.__sbPreVisit) {
9999
await globalThis.__sbPreVisit(page, context);
100100
}
101-
const result = await page.evaluate(({
101+
const result = await page.addInitScript(({
102102
id,
103103
hasPlayFn
104104
}) => __test(id, hasPlayFn), {
@@ -145,7 +145,7 @@ describe('Playwright Json', () => {
145145
if (globalThis.__sbPreVisit) {
146146
await globalThis.__sbPreVisit(page, context);
147147
}
148-
const result = await page.evaluate(({
148+
const result = await page.addInitScript(({
149149
id,
150150
hasPlayFn
151151
}) => __test(id, hasPlayFn), {
@@ -239,7 +239,7 @@ describe('Playwright Json', () => {
239239
if (globalThis.__sbPreVisit) {
240240
await globalThis.__sbPreVisit(page, context);
241241
}
242-
const result = await page.evaluate(({
242+
const result = await page.addInitScript(({
243243
id,
244244
hasPlayFn
245245
}) => __test(id, hasPlayFn), {
@@ -286,7 +286,7 @@ describe('Playwright Json', () => {
286286
if (globalThis.__sbPreVisit) {
287287
await globalThis.__sbPreVisit(page, context);
288288
}
289-
const result = await page.evaluate(({
289+
const result = await page.addInitScript(({
290290
id,
291291
hasPlayFn
292292
}) => __test(id, hasPlayFn), {
@@ -356,7 +356,7 @@ describe('Playwright Json', () => {
356356
if (globalThis.__sbPreVisit) {
357357
await globalThis.__sbPreVisit(page, context);
358358
}
359-
const result = await page.evaluate(({
359+
const result = await page.addInitScript(({
360360
id,
361361
hasPlayFn
362362
}) => __test(id, hasPlayFn), {
@@ -447,7 +447,7 @@ describe('Playwright Json', () => {
447447
if (globalThis.__sbPreVisit) {
448448
await globalThis.__sbPreVisit(page, context);
449449
}
450-
const result = await page.evaluate(({
450+
const result = await page.addInitScript(({
451451
id,
452452
hasPlayFn
453453
}) => __test(id, hasPlayFn), {
@@ -492,7 +492,7 @@ describe('Playwright Json', () => {
492492
if (globalThis.__sbPreVisit) {
493493
await globalThis.__sbPreVisit(page, context);
494494
}
495-
const result = await page.evaluate(({
495+
const result = await page.addInitScript(({
496496
id,
497497
hasPlayFn
498498
}) => __test(id, hasPlayFn), {
@@ -539,7 +539,7 @@ describe('Playwright Json', () => {
539539
if (globalThis.__sbPreVisit) {
540540
await globalThis.__sbPreVisit(page, context);
541541
}
542-
const result = await page.evaluate(({
542+
const result = await page.addInitScript(({
543543
id,
544544
hasPlayFn
545545
}) => __test(id, hasPlayFn), {
@@ -618,7 +618,7 @@ describe('Playwright Json', () => {
618618
if (globalThis.__sbPreVisit) {
619619
await globalThis.__sbPreVisit(page, context);
620620
}
621-
const result = await page.evaluate(({
621+
const result = await page.addInitScript(({
622622
id,
623623
hasPlayFn
624624
}) => __test(id, hasPlayFn), {

0 commit comments

Comments
 (0)