Or can I remove it from git? Beacuse it is annoying to add new commit just beacuse index.test.js.snap
changed...
Snapshot tests are a very useful tool whenever you want to make sure your UI does not change unexpectedly. A typical snapshot test case renders a UI component, takes a snapshot, then compares it to a reference snapshot file stored alongside the test.
Jest has always been placing snapshots in the __snapshots__ folder right next to your tests.
To review your snapshots, run npm run jest-html ( yarn run jest-html ). This launches your default browser and opens the jest-html application. By default, jest-html looks for snapshots under **/*. snap,!
The main difference between snapshot testing and functional/unit tests is, snapshot tests never assert the correct behavior of the application functionality but does an output comparison instead. There are two types of tools that support frontend snapshot testing.
The idea is that you put them into git, and next time the test is run it compares the result against the snapshot. If it gets the same result as the snapshot it will pass otherwise it fails. Without having the snapshots in git the whole concept would make no sense.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With