Storybook: Jest not recognising/updating Storyshots

Created on 24 Apr 2018  路  7Comments  路  Source: storybookjs/storybook

Bug or support request summary

Hello everyone,

I am trying to setup Storyshots on a project I am working on.
The initial snapshot generation is successful, however, all following changes are not picked up by jest's watch mode. If I want to update the snapshots, I have to use npm run test -- -u - which isn't ideal, as the tests never visibly fail.

From the screenshot in the readme, this shouldn't happen - so I am not sure as to what I am doing wrong.

Steps to reproduce

I am not sure what, in particular, is causing this to happen. My setup uses Microsoft/TypeScript-React-Starter, perhaps that's related. Explicitly writing a snapshot test seems to work as expected, so the issue appears to be solely related to storyshots. I have created a test repository which can be used to reproduce the issue. You can find it here: https://github.com/Braden1996/ts-react-boilerplate

Please specify which version of Storybook and optionally any affected addons that you're running

  • "@storybook/addon-storyshots": "^3.4.1",
  • "@storybook/react": "^3.4.1",

Affected platforms

Please see my project's package.json

Screenshots / Screencast / Code Snippets (Optional)

Screenshot in the readme:
Jest Watch in Readme

Screenshot from my terminal:
screen shot 2018-04-24 at 14 15 22
(notice Snapshots: 0 total)

storyshots compatibility with other tools inactive question / support

Most helpful comment

@igor-dv I did some digging and worked on solving the issue there: https://github.com/igor-dv/jest-specific-snapshot/pull/9. Please let me know what you think of it :)

All 7 comments

Okay, so this was a result of using multiSnapshotWithOptions. Unfortunately, as this brilliant article explains, it is a smart "monkey patch" - to state a custom snapshot filename. However, it has a few caveats; including the inability to update snapshots.

Hey @Braden1996, multi-snapshots should work with manual updating. I wasn't aware of the watch mode that automatically updates snapshot, so I should probably check it.

Small update here, I've tried multisnapshots outside the storybook (in the jest-specific-snapshot repo) and even though there was no a u command, I was able to press u and to update the snapshots. Here, in storybook it's not available (can't understand why, maybe because of the different Jest versions).

Anyway, I will try to check if it's possible to add a custom command to the watch.

@igor-dv I did some digging and worked on solving the issue there: https://github.com/igor-dv/jest-specific-snapshot/pull/9. Please let me know what you think of it :)

I've published the change as v1.0.0.

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

It was released

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rpersaud picture rpersaud  路  3Comments

shilman picture shilman  路  3Comments

tomitrescak picture tomitrescak  路  3Comments

sakulstra picture sakulstra  路  3Comments

levithomason picture levithomason  路  3Comments