Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: Fix test-runner build step #19255

Merged
merged 13 commits into from
Oct 10, 2022
Prev Previous commit
Next Next commit
Skip error stories in the test runner only
  • Loading branch information
shilman committed Oct 8, 2022
commit 5054605a9a2455ac16aff76ab069641d354f1d57
4 changes: 4 additions & 0 deletions code/renderers/react/template/stories/errors.stories.tsx
Original file line number Diff line number Diff line change
@@ -9,6 +9,10 @@ export default {
storyshots: { disable: true },
chromatic: { disable: true },
},
decorators: [
// Skip errors if we are running in the test runner
(storyFn) => window?.navigator?.userAgent?.match(/StorybookTestRunner/) || storyFn(),
],
};

export const RenderThrows = {
10 changes: 1 addition & 9 deletions scripts/sandbox.ts
Original file line number Diff line number Diff line change
@@ -310,18 +310,10 @@ async function updateStoriesField(mainConfig: ConfigFile, isJs: boolean) {

// If the project is a JS project, let's make sure any linked in TS stories from the
// renderer inside src|stories are simply ignored.
let updatedStories = isJs
const updatedStories = isJs
? stories.map((specifier) => specifier.replace('js|jsx|ts|tsx', 'js|jsx'))
: stories;

if (process.env.CI) {
logger.log('Skipping error stories to avoid failures in CI...');
// TODO: once we have story tags in place, we can filter error tags instead of doing this
updatedStories = updatedStories.map((specifier) =>
specifier.replace('src/**/*.stories.@', 'src/**/!(errors)*.stories.@')
);
}

// FIXME: '*.@(mdx|stories.mdx|stories.tsx|stories.ts|stories.jsx|stories.js'
const linkedStories = path.join('..', 'template-stories', '**', '*.stories.@(js|jsx|ts|tsx|mdx)');