Skip to content

Commit

Permalink
define test function as early as possible
Browse files Browse the repository at this point in the history
  • Loading branch information
yannbf committed May 8, 2024
1 parent 6d6264c commit 4041ab4
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
6 changes: 3 additions & 3 deletions src/csf/__snapshots__/transformCsf.test.ts.snap
Expand Up @@ -29,7 +29,7 @@ if (!require.main) {
if (globalThis.__sbPreVisit) {
await globalThis.__sbPreVisit(page, context);
}
const result = await page.evaluate(({
const result = await page.addInitScript(({
id,
hasPlayFn
}) => __test(id, hasPlayFn), {
Expand Down Expand Up @@ -96,7 +96,7 @@ if (!require.main) {
if (globalThis.__sbPreVisit) {
await globalThis.__sbPreVisit(page, context);
}
const result = await page.evaluate(({
const result = await page.addInitScript(({
id,
hasPlayFn
}) => __test(id, hasPlayFn), {
Expand Down Expand Up @@ -149,7 +149,7 @@ if (!require.main) {
if (globalThis.__sbPreVisit) {
await globalThis.__sbPreVisit(page, context);
}
const result = await page.evaluate(({
const result = await page.addInitScript(({
id,
hasPlayFn
}) => __test(id, hasPlayFn), {
Expand Down
20 changes: 10 additions & 10 deletions src/playwright/transformPlaywright.test.ts
Expand Up @@ -69,7 +69,7 @@ describe('Playwright', () => {
if (globalThis.__sbPreVisit) {
await globalThis.__sbPreVisit(page, context);
}
const result = await page.evaluate(({
const result = await page.addInitScript(({
id,
hasPlayFn
}) => __test(id, hasPlayFn), {
Expand Down Expand Up @@ -114,7 +114,7 @@ describe('Playwright', () => {
if (globalThis.__sbPreVisit) {
await globalThis.__sbPreVisit(page, context);
}
const result = await page.evaluate(({
const result = await page.addInitScript(({
id,
hasPlayFn
}) => __test(id, hasPlayFn), {
Expand Down Expand Up @@ -177,7 +177,7 @@ describe('Playwright', () => {
if (globalThis.__sbPreVisit) {
await globalThis.__sbPreVisit(page, context);
}
const result = await page.evaluate(({
const result = await page.addInitScript(({
id,
hasPlayFn
}) => __test(id, hasPlayFn), {
Expand Down Expand Up @@ -240,7 +240,7 @@ describe('Playwright', () => {
if (globalThis.__sbPreVisit) {
await globalThis.__sbPreVisit(page, context);
}
const result = await page.evaluate(({
const result = await page.addInitScript(({
id,
hasPlayFn
}) => __test(id, hasPlayFn), {
Expand Down Expand Up @@ -285,7 +285,7 @@ describe('Playwright', () => {
if (globalThis.__sbPreVisit) {
await globalThis.__sbPreVisit(page, context);
}
const result = await page.evaluate(({
const result = await page.addInitScript(({
id,
hasPlayFn
}) => __test(id, hasPlayFn), {
Expand Down Expand Up @@ -357,7 +357,7 @@ describe('Playwright', () => {
if (globalThis.__sbPreVisit) {
await globalThis.__sbPreVisit(page, context);
}
const result = await page.evaluate(({
const result = await page.addInitScript(({
id,
hasPlayFn
}) => __test(id, hasPlayFn), {
Expand Down Expand Up @@ -402,7 +402,7 @@ describe('Playwright', () => {
if (globalThis.__sbPreVisit) {
await globalThis.__sbPreVisit(page, context);
}
const result = await page.evaluate(({
const result = await page.addInitScript(({
id,
hasPlayFn
}) => __test(id, hasPlayFn), {
Expand Down Expand Up @@ -479,7 +479,7 @@ describe('Playwright', () => {
if (globalThis.__sbPreVisit) {
await globalThis.__sbPreVisit(page, context);
}
const result = await page.evaluate(({
const result = await page.addInitScript(({
id,
hasPlayFn
}) => __test(id, hasPlayFn), {
Expand Down Expand Up @@ -540,7 +540,7 @@ describe('Playwright', () => {
if (globalThis.__sbPreVisit) {
await globalThis.__sbPreVisit(page, context);
}
const result = await page.evaluate(({
const result = await page.addInitScript(({
id,
hasPlayFn
}) => __test(id, hasPlayFn), {
Expand Down Expand Up @@ -601,7 +601,7 @@ describe('Playwright', () => {
if (globalThis.__sbPreVisit) {
await globalThis.__sbPreVisit(page, context);
}
const result = await page.evaluate(({
const result = await page.addInitScript(({
id,
hasPlayFn
}) => __test(id, hasPlayFn), {
Expand Down
2 changes: 1 addition & 1 deletion src/playwright/transformPlaywright.ts
Expand Up @@ -25,7 +25,7 @@ export const testPrefixer: TestPrefixer = (context) => {
await globalThis.__sbPreVisit(page, context);
}
const result = await page.evaluate(({ id, hasPlayFn }) => __test(id, hasPlayFn), {
const result = await page.addInitScript(({ id, hasPlayFn }) => __test(id, hasPlayFn), {
id: %%id%%,
});
Expand Down
20 changes: 10 additions & 10 deletions src/playwright/transformPlaywrightJson.test.ts
Expand Up @@ -53,7 +53,7 @@ describe('Playwright Json', () => {
if (globalThis.__sbPreVisit) {
await globalThis.__sbPreVisit(page, context);
}
const result = await page.evaluate(({
const result = await page.addInitScript(({
id,
hasPlayFn
}) => __test(id, hasPlayFn), {
Expand Down Expand Up @@ -98,7 +98,7 @@ describe('Playwright Json', () => {
if (globalThis.__sbPreVisit) {
await globalThis.__sbPreVisit(page, context);
}
const result = await page.evaluate(({
const result = await page.addInitScript(({
id,
hasPlayFn
}) => __test(id, hasPlayFn), {
Expand Down Expand Up @@ -145,7 +145,7 @@ describe('Playwright Json', () => {
if (globalThis.__sbPreVisit) {
await globalThis.__sbPreVisit(page, context);
}
const result = await page.evaluate(({
const result = await page.addInitScript(({
id,
hasPlayFn
}) => __test(id, hasPlayFn), {
Expand Down Expand Up @@ -239,7 +239,7 @@ describe('Playwright Json', () => {
if (globalThis.__sbPreVisit) {
await globalThis.__sbPreVisit(page, context);
}
const result = await page.evaluate(({
const result = await page.addInitScript(({
id,
hasPlayFn
}) => __test(id, hasPlayFn), {
Expand Down Expand Up @@ -286,7 +286,7 @@ describe('Playwright Json', () => {
if (globalThis.__sbPreVisit) {
await globalThis.__sbPreVisit(page, context);
}
const result = await page.evaluate(({
const result = await page.addInitScript(({
id,
hasPlayFn
}) => __test(id, hasPlayFn), {
Expand Down Expand Up @@ -356,7 +356,7 @@ describe('Playwright Json', () => {
if (globalThis.__sbPreVisit) {
await globalThis.__sbPreVisit(page, context);
}
const result = await page.evaluate(({
const result = await page.addInitScript(({
id,
hasPlayFn
}) => __test(id, hasPlayFn), {
Expand Down Expand Up @@ -447,7 +447,7 @@ describe('Playwright Json', () => {
if (globalThis.__sbPreVisit) {
await globalThis.__sbPreVisit(page, context);
}
const result = await page.evaluate(({
const result = await page.addInitScript(({
id,
hasPlayFn
}) => __test(id, hasPlayFn), {
Expand Down Expand Up @@ -492,7 +492,7 @@ describe('Playwright Json', () => {
if (globalThis.__sbPreVisit) {
await globalThis.__sbPreVisit(page, context);
}
const result = await page.evaluate(({
const result = await page.addInitScript(({
id,
hasPlayFn
}) => __test(id, hasPlayFn), {
Expand Down Expand Up @@ -539,7 +539,7 @@ describe('Playwright Json', () => {
if (globalThis.__sbPreVisit) {
await globalThis.__sbPreVisit(page, context);
}
const result = await page.evaluate(({
const result = await page.addInitScript(({
id,
hasPlayFn
}) => __test(id, hasPlayFn), {
Expand Down Expand Up @@ -618,7 +618,7 @@ describe('Playwright Json', () => {
if (globalThis.__sbPreVisit) {
await globalThis.__sbPreVisit(page, context);
}
const result = await page.evaluate(({
const result = await page.addInitScript(({
id,
hasPlayFn
}) => __test(id, hasPlayFn), {
Expand Down

0 comments on commit 4041ab4

Please sign in to comment.