Skip to content

Commit

Permalink
Merge pull request #464 from storybookjs/yann/fix-standalone-index-js…
Browse files Browse the repository at this point in the history
…on-mode

Fix: Skip requiring a main.js file in index.json mode
  • Loading branch information
yannbf authored May 17, 2024
2 parents 24d729f + 5ad382f commit a038ece
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 a038ece

Please sign in to comment.