styleguidist/snapguidist

Usage with Create React App

randytorres opened this issue · 4 comments

How can I use this with Create React App? I am getting an error 10 obsolete snapshot files found, press `u` to remove them..

This is interesting, I was able to repro @randytorres - thanks for opening the issue.
So, it looks like the Jest config within CRA finds out the Snapguidist snapshots folder.
Unfortunately, there's no way to override the Jest configuration (except from ejecting).
I think the solution would be to remove (or just rename) the snapshots folder from this package, would you be happy to work on a PR?

I am ready to send you a PR to fix this. But, changing the snapshots folder name is not an option. Jest fin the snapshot no matter the name of the folder. So, an easy fix is to rename the extension. I've prepared a fix renaming ".snap" by ".snap_" but if you prefer anything else, let me know.

Just found that: facebook/jest#4383:
"Jest ensures consistency of snapshots globally across your config, regardless of which tests you are concretely running. This is intentional."
Which let think the issue is not related to CRA but Jest.

Thank you very much for working on this and providing more information, @YohMer.
If that's the case I would suggest we use .sg (SnapGuidist) as file extension.