Skip to content

Commit

Permalink
Skip error stories in storyshots
Browse files Browse the repository at this point in the history
  • Loading branch information
tmeasday committed Aug 9, 2018
1 parent d15db5a commit deef786
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions examples/official-storybook/stories/core.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { storiesOf, addParameters } from '@storybook/react';
import addons from '@storybook/addons';
import Events from '@storybook/core-events';
import { Button } from '@storybook/components';
import { navigator } from 'global';

const globalParameter = 'globalParameter';
const chapterParameter = 'chapterParameter';
Expand Down Expand Up @@ -32,9 +33,13 @@ storiesOf('Core|Events', module).add('Force re-render', () => (
<Button onClick={increment}>Clicked: {timesClicked}</Button>
));

storiesOf('Core|Errors', module)
.add('story throws exception', () => {
throw new Error('error');
})
// Story does not return something react can render
.add('story errors', () => null);
// Skip these stories in storyshots, they will throw -- NOTE: would rather do this
// via a params API, see https://github.com/storybooks/storybook/pull/3967#issuecomment-411616023
if (navigator && navigator.userAgent && !(navigator.userAgent.indexOf('jsdom') > -1)) {
storiesOf('Core|Errors', module)
.add('story throws exception', () => {
throw new Error('error');
})
// Story does not return something react can render
.add('story errors', () => null);
}

0 comments on commit deef786

Please sign in to comment.