-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Capture errors thrown by stories and report them for simpler de…
…bugging (#22)
- Loading branch information
1 parent
5c65d3c
commit 6b8ef8a
Showing
9 changed files
with
197 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React from 'react' | ||
import { Meta, StoryObj } from '@storybook/react' | ||
|
||
import { FailSwitch } from './FailSwitch' | ||
|
||
export default { | ||
title: 'Example/FailSwitch', | ||
component: FailSwitch, | ||
} as Meta | ||
|
||
type Story = StoryObj<typeof FailSwitch> | ||
|
||
export const Example: Story = { | ||
render: () => <FailSwitch />, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React from 'react' | ||
|
||
interface FailSwitchProps { | ||
fail?: boolean | ||
} | ||
|
||
export const FailSwitch = ({ | ||
fail = false, | ||
}: FailSwitchProps) => { | ||
if (fail) { | ||
throw new Error('FailSwitch was forced to fail.') | ||
} | ||
|
||
return ( | ||
<p>Hello</p> | ||
) | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
diff --git a/sample-storybook/src/stories/FailSwitch.stories.tsx b/sample-storybook/src/stories/FailSwitch.stories.tsx | ||
index 1d5103f..2b4d847 100644 | ||
--- a/sample-storybook/src/stories/FailSwitch.stories.tsx | ||
+++ b/sample-storybook/src/stories/FailSwitch.stories.tsx | ||
@@ -11,5 +11,5 @@ export default { | ||
type Story = StoryObj<typeof FailSwitch> | ||
|
||
export const Example: Story = { | ||
- render: () => <FailSwitch />, | ||
+ render: () => <FailSwitch fail />, | ||
} |