From deef786c2b50b2aa1240b5c28bcc8e201a7d3c3b Mon Sep 17 00:00:00 2001 From: Tom Coleman Date: Thu, 9 Aug 2018 12:27:54 +1000 Subject: [PATCH] Skip error stories in storyshots --- .../official-storybook/stories/core.stories.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/examples/official-storybook/stories/core.stories.js b/examples/official-storybook/stories/core.stories.js index e499b387d413..4b372a00f0c3 100644 --- a/examples/official-storybook/stories/core.stories.js +++ b/examples/official-storybook/stories/core.stories.js @@ -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'; @@ -32,9 +33,13 @@ storiesOf('Core|Events', module).add('Force re-render', () => ( )); -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); +}