Skip to content

Commit

Permalink
test: fix storybook's __test is not defined errors (#228)
Browse files Browse the repository at this point in the history
  • Loading branch information
AriPerkkio authored Aug 12, 2024
1 parent 5db272b commit 5dc66a8
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 2 deletions.
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,10 @@
"singleQuote": true,
"tabWidth": 4,
"printWidth": 80
},
"pnpm": {
"patchedDependencies": {
"@storybook/test-runner": "patches/@storybook__test-runner.patch"
}
}
}
52 changes: 52 additions & 0 deletions patches/@storybook__test-runner.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
diff --git a/dist/index.js b/dist/index.js
index accc3632466e5b25b0122b2961e7c94a80a2759b..1984513ac34861abe5d800cbfa2dd7ddad770bef 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -13566,7 +13566,7 @@ var testPrefixer = /* @__PURE__ */ __name((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%%,
});

diff --git a/dist/index.mjs b/dist/index.mjs
index 3bef97836744b3c38d5cf7cbf1a7da806ea1b850..d3fc1cfdecad3eed12566bdfb8b51d4da4a339dc 100644
--- a/dist/index.mjs
+++ b/dist/index.mjs
@@ -13549,7 +13549,7 @@ var testPrefixer = /* @__PURE__ */ __name((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%%,
});

diff --git a/dist/test-storybook.js b/dist/test-storybook.js
index f5f2a8f08d189c87316d69aabe906d2ef320e02d..c36a2d6bfc398dc593d56feb2f4290f6f5e21aa3 100755
--- a/dist/test-storybook.js
+++ b/dist/test-storybook.js
@@ -17623,7 +17623,7 @@ var testPrefixer = /* @__PURE__ */ __name((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%%,
});

diff --git a/dist/test-storybook.mjs b/dist/test-storybook.mjs
index 2ac7d7a93f6582ea736dff80709646ede0def3fd..14f3dc1cb9b69a203604609075c82acaf1206874 100755
--- a/dist/test-storybook.mjs
+++ b/dist/test-storybook.mjs
@@ -17629,7 +17629,7 @@ var testPrefixer = /* @__PURE__ */ __name((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%%,
});

9 changes: 7 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5dc66a8

Please sign in to comment.