We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 2db1f41 + 7c214e7 commit eec1662Copy full SHA for eec1662
1 file changed
.storybook/test-runner.ts
@@ -0,0 +1,23 @@
1
+import type { TestRunnerConfig } from '@storybook/test-runner';
2
+
3
+// Extend Window interface to include __test property
4
+// Note: This variable is referenced in test-runner's page.evaluate calls
5
+// but not directly in our codebase. It appears to be expected by the test environment.
6
+declare global {
7
+ interface Window {
8
+ __test?: boolean;
9
+ }
10
+}
11
12
+const config: TestRunnerConfig = {
13
+ async preVisit(page) {
14
+ // Inject __test global to prevent ReferenceError during test execution
15
+ // This addresses the error: "page.evaluate: ReferenceError: __test is not defined"
16
+ // that occurs when running Storybook test-runner smoke tests
17
+ await page.evaluate(() => {
18
+ window.__test = true;
19
+ });
20
+ },
21
+};
22
23
+export default config;
0 commit comments