Skip to content
Closed
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
12 changes: 6 additions & 6 deletions src/csf/__snapshots__/transformCsf.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ if (!require.main) {
}
let result;
try {
result = await page.evaluate(({
result = await page.addInitScript(({
id,
hasPlayFn
}) => __test(id, hasPlayFn), {
Expand All @@ -54,7 +54,7 @@ if (!require.main) {
await globalThis.__sbPostVisit(page, context);
}
if (globalThis.__sbCollectCoverage) {
const isCoverageSetupCorrectly = await page.evaluate(() => '__coverage__' in window);
const isCoverageSetupCorrectly = await page.addInitScript(() => '__coverage__' in window);
if (!isCoverageSetupCorrectly) {
throw new Error(\`[Test runner] An error occurred when evaluating code coverage:
The code in this story is not instrumented, which means the coverage setup is likely not correct.
Expand Down Expand Up @@ -113,7 +113,7 @@ if (!require.main) {
}
let result;
try {
result = await page.evaluate(({
result = await page.addInitScript(({
id,
hasPlayFn
}) => __test(id, hasPlayFn), {
Expand All @@ -136,7 +136,7 @@ if (!require.main) {
await globalThis.__sbPostVisit(page, context);
}
if (globalThis.__sbCollectCoverage) {
const isCoverageSetupCorrectly = await page.evaluate(() => '__coverage__' in window);
const isCoverageSetupCorrectly = await page.addInitScript(() => '__coverage__' in window);
if (!isCoverageSetupCorrectly) {
throw new Error(\`[Test runner] An error occurred when evaluating code coverage:
The code in this story is not instrumented, which means the coverage setup is likely not correct.
Expand Down Expand Up @@ -181,7 +181,7 @@ if (!require.main) {
}
let result;
try {
result = await page.evaluate(({
result = await page.addInitScript(({
id,
hasPlayFn
}) => __test(id, hasPlayFn), {
Expand All @@ -204,7 +204,7 @@ if (!require.main) {
await globalThis.__sbPostVisit(page, context);
}
if (globalThis.__sbCollectCoverage) {
const isCoverageSetupCorrectly = await page.evaluate(() => '__coverage__' in window);
const isCoverageSetupCorrectly = await page.addInitScript(() => '__coverage__' in window);
if (!isCoverageSetupCorrectly) {
throw new Error(\`[Test runner] An error occurred when evaluating code coverage:
The code in this story is not instrumented, which means the coverage setup is likely not correct.
Expand Down
60 changes: 30 additions & 30 deletions src/playwright/transformPlaywright.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ describe('Playwright', () => {
}
let result;
try {
result = await page.evaluate(({
result = await page.addInitScript(({
id,
hasPlayFn
}) => __test(id, hasPlayFn), {
Expand All @@ -95,7 +95,7 @@ describe('Playwright', () => {
await globalThis.__sbPostVisit(page, context);
}
if (globalThis.__sbCollectCoverage) {
const isCoverageSetupCorrectly = await page.evaluate(() => '__coverage__' in window);
const isCoverageSetupCorrectly = await page.addInitScript(() => '__coverage__' in window);
if (!isCoverageSetupCorrectly) {
throw new Error(\`[Test runner] An error occurred when evaluating code coverage:
The code in this story is not instrumented, which means the coverage setup is likely not correct.
Expand Down Expand Up @@ -132,7 +132,7 @@ describe('Playwright', () => {
}
let result;
try {
result = await page.evaluate(({
result = await page.addInitScript(({
id,
hasPlayFn
}) => __test(id, hasPlayFn), {
Expand All @@ -155,7 +155,7 @@ describe('Playwright', () => {
await globalThis.__sbPostVisit(page, context);
}
if (globalThis.__sbCollectCoverage) {
const isCoverageSetupCorrectly = await page.evaluate(() => '__coverage__' in window);
const isCoverageSetupCorrectly = await page.addInitScript(() => '__coverage__' in window);
if (!isCoverageSetupCorrectly) {
throw new Error(\`[Test runner] An error occurred when evaluating code coverage:
The code in this story is not instrumented, which means the coverage setup is likely not correct.
Expand Down Expand Up @@ -210,7 +210,7 @@ describe('Playwright', () => {
}
let result;
try {
result = await page.evaluate(({
result = await page.addInitScript(({
id,
hasPlayFn
}) => __test(id, hasPlayFn), {
Expand All @@ -233,7 +233,7 @@ describe('Playwright', () => {
await globalThis.__sbPostVisit(page, context);
}
if (globalThis.__sbCollectCoverage) {
const isCoverageSetupCorrectly = await page.evaluate(() => '__coverage__' in window);
const isCoverageSetupCorrectly = await page.addInitScript(() => '__coverage__' in window);
if (!isCoverageSetupCorrectly) {
throw new Error(\`[Test runner] An error occurred when evaluating code coverage:
The code in this story is not instrumented, which means the coverage setup is likely not correct.
Expand Down Expand Up @@ -288,7 +288,7 @@ describe('Playwright', () => {
}
let result;
try {
result = await page.evaluate(({
result = await page.addInitScript(({
id,
hasPlayFn
}) => __test(id, hasPlayFn), {
Expand All @@ -311,7 +311,7 @@ describe('Playwright', () => {
await globalThis.__sbPostVisit(page, context);
}
if (globalThis.__sbCollectCoverage) {
const isCoverageSetupCorrectly = await page.evaluate(() => '__coverage__' in window);
const isCoverageSetupCorrectly = await page.addInitScript(() => '__coverage__' in window);
if (!isCoverageSetupCorrectly) {
throw new Error(\`[Test runner] An error occurred when evaluating code coverage:
The code in this story is not instrumented, which means the coverage setup is likely not correct.
Expand Down Expand Up @@ -348,7 +348,7 @@ describe('Playwright', () => {
}
let result;
try {
result = await page.evaluate(({
result = await page.addInitScript(({
id,
hasPlayFn
}) => __test(id, hasPlayFn), {
Expand All @@ -371,7 +371,7 @@ describe('Playwright', () => {
await globalThis.__sbPostVisit(page, context);
}
if (globalThis.__sbCollectCoverage) {
const isCoverageSetupCorrectly = await page.evaluate(() => '__coverage__' in window);
const isCoverageSetupCorrectly = await page.addInitScript(() => '__coverage__' in window);
if (!isCoverageSetupCorrectly) {
throw new Error(\`[Test runner] An error occurred when evaluating code coverage:
The code in this story is not instrumented, which means the coverage setup is likely not correct.
Expand Down Expand Up @@ -439,7 +439,7 @@ describe('Playwright', () => {
}
let result;
try {
result = await page.evaluate(({
result = await page.addInitScript(({
id,
hasPlayFn
}) => __test(id, hasPlayFn), {
Expand All @@ -462,7 +462,7 @@ describe('Playwright', () => {
await globalThis.__sbPostVisit(page, context);
}
if (globalThis.__sbCollectCoverage) {
const isCoverageSetupCorrectly = await page.evaluate(() => '__coverage__' in window);
const isCoverageSetupCorrectly = await page.addInitScript(() => '__coverage__' in window);
if (!isCoverageSetupCorrectly) {
throw new Error(\`[Test runner] An error occurred when evaluating code coverage:
The code in this story is not instrumented, which means the coverage setup is likely not correct.
Expand Down Expand Up @@ -499,7 +499,7 @@ describe('Playwright', () => {
}
let result;
try {
result = await page.evaluate(({
result = await page.addInitScript(({
id,
hasPlayFn
}) => __test(id, hasPlayFn), {
Expand All @@ -522,7 +522,7 @@ describe('Playwright', () => {
await globalThis.__sbPostVisit(page, context);
}
if (globalThis.__sbCollectCoverage) {
const isCoverageSetupCorrectly = await page.evaluate(() => '__coverage__' in window);
const isCoverageSetupCorrectly = await page.addInitScript(() => '__coverage__' in window);
if (!isCoverageSetupCorrectly) {
throw new Error(\`[Test runner] An error occurred when evaluating code coverage:
The code in this story is not instrumented, which means the coverage setup is likely not correct.
Expand Down Expand Up @@ -559,7 +559,7 @@ describe('Playwright', () => {
}
let result;
try {
result = await page.evaluate(({
result = await page.addInitScript(({
id,
hasPlayFn
}) => __test(id, hasPlayFn), {
Expand All @@ -582,7 +582,7 @@ describe('Playwright', () => {
await globalThis.__sbPostVisit(page, context);
}
if (globalThis.__sbCollectCoverage) {
const isCoverageSetupCorrectly = await page.evaluate(() => '__coverage__' in window);
const isCoverageSetupCorrectly = await page.addInitScript(() => '__coverage__' in window);
if (!isCoverageSetupCorrectly) {
throw new Error(\`[Test runner] An error occurred when evaluating code coverage:
The code in this story is not instrumented, which means the coverage setup is likely not correct.
Expand Down Expand Up @@ -619,7 +619,7 @@ describe('Playwright', () => {
}
let result;
try {
result = await page.evaluate(({
result = await page.addInitScript(({
id,
hasPlayFn
}) => __test(id, hasPlayFn), {
Expand All @@ -642,7 +642,7 @@ describe('Playwright', () => {
await globalThis.__sbPostVisit(page, context);
}
if (globalThis.__sbCollectCoverage) {
const isCoverageSetupCorrectly = await page.evaluate(() => '__coverage__' in window);
const isCoverageSetupCorrectly = await page.addInitScript(() => '__coverage__' in window);
if (!isCoverageSetupCorrectly) {
throw new Error(\`[Test runner] An error occurred when evaluating code coverage:
The code in this story is not instrumented, which means the coverage setup is likely not correct.
Expand Down Expand Up @@ -703,7 +703,7 @@ describe('Playwright', () => {
}
let result;
try {
result = await page.evaluate(({
result = await page.addInitScript(({
id,
hasPlayFn
}) => __test(id, hasPlayFn), {
Expand All @@ -726,7 +726,7 @@ describe('Playwright', () => {
await globalThis.__sbPostVisit(page, context);
}
if (globalThis.__sbCollectCoverage) {
const isCoverageSetupCorrectly = await page.evaluate(() => '__coverage__' in window);
const isCoverageSetupCorrectly = await page.addInitScript(() => '__coverage__' in window);
if (!isCoverageSetupCorrectly) {
throw new Error(\`[Test runner] An error occurred when evaluating code coverage:
The code in this story is not instrumented, which means the coverage setup is likely not correct.
Expand Down Expand Up @@ -763,7 +763,7 @@ describe('Playwright', () => {
}
let result;
try {
result = await page.evaluate(({
result = await page.addInitScript(({
id,
hasPlayFn
}) => __test(id, hasPlayFn), {
Expand All @@ -786,7 +786,7 @@ describe('Playwright', () => {
await globalThis.__sbPostVisit(page, context);
}
if (globalThis.__sbCollectCoverage) {
const isCoverageSetupCorrectly = await page.evaluate(() => '__coverage__' in window);
const isCoverageSetupCorrectly = await page.addInitScript(() => '__coverage__' in window);
if (!isCoverageSetupCorrectly) {
throw new Error(\`[Test runner] An error occurred when evaluating code coverage:
The code in this story is not instrumented, which means the coverage setup is likely not correct.
Expand Down Expand Up @@ -843,7 +843,7 @@ describe('Playwright', () => {
}
let result;
try {
result = await page.evaluate(({
result = await page.addInitScript(({
id,
hasPlayFn
}) => __test(id, hasPlayFn), {
Expand All @@ -866,7 +866,7 @@ describe('Playwright', () => {
await globalThis.__sbPostVisit(page, context);
}
if (globalThis.__sbCollectCoverage) {
const isCoverageSetupCorrectly = await page.evaluate(() => '__coverage__' in window);
const isCoverageSetupCorrectly = await page.addInitScript(() => '__coverage__' in window);
if (!isCoverageSetupCorrectly) {
throw new Error(\`[Test runner] An error occurred when evaluating code coverage:
The code in this story is not instrumented, which means the coverage setup is likely not correct.
Expand Down Expand Up @@ -935,7 +935,7 @@ describe('Playwright', () => {
}
let result;
try {
result = await page.evaluate(({
result = await page.addInitScript(({
id,
hasPlayFn
}) => __test(id, hasPlayFn), {
Expand All @@ -958,7 +958,7 @@ describe('Playwright', () => {
await globalThis.__sbPostVisit(page, context);
}
if (globalThis.__sbCollectCoverage) {
const isCoverageSetupCorrectly = await page.evaluate(() => '__coverage__' in window);
const isCoverageSetupCorrectly = await page.addInitScript(() => '__coverage__' in window);
if (!isCoverageSetupCorrectly) {
throw new Error(\`[Test runner] An error occurred when evaluating code coverage:
The code in this story is not instrumented, which means the coverage setup is likely not correct.
Expand Down Expand Up @@ -1011,7 +1011,7 @@ describe('Playwright', () => {
}
let result;
try {
result = await page.evaluate(({
result = await page.addInitScript(({
id,
hasPlayFn
}) => __test(id, hasPlayFn), {
Expand All @@ -1034,7 +1034,7 @@ describe('Playwright', () => {
await globalThis.__sbPostVisit(page, context);
}
if (globalThis.__sbCollectCoverage) {
const isCoverageSetupCorrectly = await page.evaluate(() => '__coverage__' in window);
const isCoverageSetupCorrectly = await page.addInitScript(() => '__coverage__' in window);
if (!isCoverageSetupCorrectly) {
throw new Error(\`[Test runner] An error occurred when evaluating code coverage:
The code in this story is not instrumented, which means the coverage setup is likely not correct.
Expand Down Expand Up @@ -1087,7 +1087,7 @@ describe('Playwright', () => {
}
let result;
try {
result = await page.evaluate(({
result = await page.addInitScript(({
id,
hasPlayFn
}) => __test(id, hasPlayFn), {
Expand All @@ -1110,7 +1110,7 @@ describe('Playwright', () => {
await globalThis.__sbPostVisit(page, context);
}
if (globalThis.__sbCollectCoverage) {
const isCoverageSetupCorrectly = await page.evaluate(() => '__coverage__' in window);
const isCoverageSetupCorrectly = await page.addInitScript(() => '__coverage__' in window);
if (!isCoverageSetupCorrectly) {
throw new Error(\`[Test runner] An error occurred when evaluating code coverage:
The code in this story is not instrumented, which means the coverage setup is likely not correct.
Expand Down
4 changes: 2 additions & 2 deletions src/playwright/transformPlaywright.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const testPrefixer: TestPrefixer = (context) => {

let result;
try {
result = await page.evaluate(({ id, hasPlayFn }) => __test(id, hasPlayFn), {
result = await page.addInitScript(({ id, hasPlayFn }) => __test(id, hasPlayFn), {
id: %%id%%,
});
} catch(err) {
Expand All @@ -47,7 +47,7 @@ export const testPrefixer: TestPrefixer = (context) => {
}

if(globalThis.__sbCollectCoverage) {
const isCoverageSetupCorrectly = await page.evaluate(() => '__coverage__' in window);
const isCoverageSetupCorrectly = await page.addInitScript(() => '__coverage__' in window);
if (!isCoverageSetupCorrectly) {
throw new Error(\`${coverageErrorMessage}\`);
}
Expand Down
Loading
Loading