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

switch jest snapshots to use storyshots #196

Open
apaleslimghost opened this issue Oct 9, 2018 · 3 comments
Open

switch jest snapshots to use storyshots #196

apaleslimghost opened this issue Oct 9, 2018 · 3 comments
Labels
good first issue Good for newcomers housekeeping Cleaning things up

Comments

@apaleslimghost
Copy link
Member

https://github.com/storybooks/storybook/tree/release/3.4/addons/storyshots

pros:

  • less custom x-dash magic is good

cons:

  • i do not trust storybook
@apaleslimghost apaleslimghost added good first issue Good for newcomers housekeeping Cleaning things up labels Oct 9, 2018
@i-like-robots
Copy link
Contributor

i-like-robots commented Oct 9, 2018

I think the latter is why I avoided it when first implementing snapshots...

We could get rid of the "magic" aspect and instead encourage/force components to include their own tests (which would resolve #152). There may be some repetition but that's OK, it's one code base so refactors are possible!

@apaleslimghost
Copy link
Member Author

apaleslimghost commented Oct 11, 2018

how would you feel about adding something to x-test-utils to do this? then each component would have its own __tests__ folder that could do something like:

import { storySnapshotTests } from '@financial-times/x-test-utils';

describe('x-teaser', () => {
  storySnapshotTests();
});

edit: maybe make it more explicit:

import stories from '../stories';
import { storySnapshotTests } from '@financial-times/x-test-utils';

describe('x-teaser', () => {
  storySnapshotTests(stories);
});

@i-like-robots
Copy link
Contributor

Pretty OK!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers housekeeping Cleaning things up
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants