We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 496ab2a commit 7c214e7Copy full SHA for 7c214e7
1 file changed
.storybook/test-runner.ts
@@ -1,10 +1,21 @@
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(() => {
- (window as any).__test = true;
18
+ window.__test = true;
19
});
20
},
21
};
0 commit comments