Skip to content

Commit

Permalink
Fix: Skip requiring a main.js file in index.json mode
Browse files Browse the repository at this point in the history
  • Loading branch information
yannbf committed May 17, 2024
1 parent 24d729f commit 5ad382f
Show file tree
Hide file tree
Showing 3 changed files with 1,424 additions and 2,431 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"@babel/preset-env": "^7.19.4",
"@babel/preset-react": "^7.18.6",
"@babel/preset-typescript": "^7.18.6",
"@storybook/addon-coverage": "^0.0.9",
"@storybook/addon-coverage": "^1.0.0",
"@storybook/addon-essentials": "next",
"@storybook/addon-interactions": "next",
"@storybook/react": "next",
Expand Down
18 changes: 10 additions & 8 deletions src/test-storybook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -362,19 +362,21 @@ const main = async () => {
process.env.TEST_MATCH = '**/*.test.js';
}

const { storiesPaths, lazyCompilation } = getStorybookMetadata();
process.env.STORYBOOK_STORIES_PATTERN = storiesPaths;
if (!shouldRunIndexJson) {
const { storiesPaths, lazyCompilation } = getStorybookMetadata();
process.env.STORYBOOK_STORIES_PATTERN = storiesPaths;

if (lazyCompilation && isLocalStorybookIp) {
log(
`You're running Storybook with lazy compilation enabled, and will likely cause issues with the test runner locally. Consider disabling 'lazyCompilation' in ${runnerOptions.configDir}/main.js when running 'test-storybook' locally.`
);
}
}

if (runnerOptions.failOnConsole) {
process.env.TEST_CHECK_CONSOLE = 'true';
}

if (lazyCompilation && isLocalStorybookIp) {
log(
`You're running Storybook with lazy compilation enabled, and will likely cause issues with the test runner locally. Consider disabling 'lazyCompilation' in ${runnerOptions.configDir}/main.js when running 'test-storybook' locally.`
);
}

await executeJestPlaywright(jestOptions);
};

Expand Down
Loading

0 comments on commit 5ad382f

Please sign in to comment.