Skip to content

Commit

Permalink
Add a noMatchSnapshots option.
Browse files Browse the repository at this point in the history
  • Loading branch information
tmeasday committed Apr 28, 2017
1 parent 10d74a3 commit c1c0489
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions packages/storyshots/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,7 @@ initStoryshots({
```

Here is an example of [a regex](https://regex101.com/r/vkBaAt/2) which does not pass if `"Relay"` is in the name: `/^((?!(r|R)elay).)*$/`.

### `noMatchSnapshots`

If you don't want to run snapshot tests, but instead just ensure that your stories render without error, pass `noMatchSnapshots: true`. This will "smoke" test your stories and make sure you haven't broken anything, which is appropriate early in the development process.
4 changes: 3 additions & 1 deletion packages/storyshots/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ export default function testStorySnapshots(options = {}) {
const context = { kind: group.kind, story: story.name };
const renderedStory = story.render(context);
const tree = renderer.create(renderedStory).toJSON();
expect(tree).toMatchSnapshot();
if (!options.noMatchSnapshots) {
expect(tree).toMatchSnapshot();
}
});
}
});
Expand Down

0 comments on commit c1c0489

Please sign in to comment.