Do not write snapshots by default on CI#3456
Conversation
6b25a98 to
4ff1379
Compare
|
In the last commit, there are some unrelated changes because prettier was being funny. I think it's all fixed now and those are the properly printed values. Sorry for the churn there. |
|
Was this PR merged without any updates to the docs? I am getting the P.S. I am adding the update flag... still getting this error. |
|
It seems like you aren't adding snapshots to your CI and therefore using snapshots wrongly. The documentation is on the website: http://facebook.github.io/jest/docs/en/snapshot-testing.html#snapshots-are-not-written-automatically-on-continuous-integration-systems-ci |
|
@cpojer I am still struggling here. It seems like the point of this change is to prevent snapshot checks from running in a CI environment, but I cannot figure out why that is a good idea. All my snapshots are committed in the repo. So a snapshot check should pass or fail just like it does in a local dev env, no? I have also since removed the Thanks in advance for your guidance. |
|
Never mind. I think I get it now. The point of the change is to not allow snapshots to be created in a CI env. To give snapshot changes a better chance to truly fail. Sorry for the confusion. |
* Better flow typings for snapshots. * Remove `initializeSnapshotState`. * Do not write snapshots by default on CI systems. * Tests + updateSnapshot fixes.
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Summary
When running on a CI environment or with
--ci, Jest will now refuse to write new snapshots. This is so that on CI, uncommitted snapshots will fail rather than pass by writing new files every time.I introduced a
--cifield and changed theupdateSnapshotfield into one of three states:none,allornew. None won't write any snapshot files,allwill write all and clean snapshots up andnewwill only create new snapshots.Test plan
jest