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

Documentation for Interactive Snapshot Update #5291

Merged
merged 18 commits into from
Feb 10, 2018
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
## master

### Fixes

* `[doc]` Add information about Interactive Snapshot update
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit - this is [docs] everywhere else

([#5291](https://github.com/facebook/jest/pull/5291))

## jest 22.1.3

### Fixes
Expand Down Expand Up @@ -28,16 +33,23 @@
* `[jest-cli]` Make Jest exit without an error when no tests are found in the
case of `--lastCommit`, `--findRelatedTests`, or `--onlyChanged` options
having been passed to the CLI
* `[jest-cli]` Interactive Snapshot Update: allow to review and update
individual snapshot failure
([#3831](https://github.com/facebook/jest/pull/3831))

### Fixes

* `[jest-cli]` Use `import-local` to support global Jest installations.
([#5304](https://github.com/facebook/jest/pull/5304))
* `[jest-runner]` Fix memory leak in coverage reporting
([#5289](https://github.com/facebook/jest/pull/5289))
* `[docs]` Update mention of the minimal version of node supported [#4947](https://github.com/facebook/jest/issues/4947)
* `[jest-cli]` Fix missing newline in console message ([#5308](https://github.com/facebook/jest/pull/5308))
* `[docs]` Update mention of the minimal version of node supported
[#4947](https://github.com/facebook/jest/issues/4947)
* `[jest-cli]` Fix missing newline in console message
([#5308](https://github.com/facebook/jest/pull/5308))
* `[jest-cli]` `--lastCommit` and `--changedFilesWithAncestor` now take effect
even when `--onlyChanged` is not specified. ([#5307](https://github.com/facebook/jest/pull/5307))
even when `--onlyChanged` is not specified.
([#5307](https://github.com/facebook/jest/pull/5307))

### Chore & Maintenance

Expand All @@ -52,9 +64,6 @@
([#5279](https://github.com/facebook/jest/pull/5279))
* `[jest-config]` Fix breaking change in `--testPathPattern`
([#5269](https://github.com/facebook/jest/pull/5269))

### Fixes

* `[docs]` Document caveat with mocks, Enzyme, snapshots and React 16
([#5258](https://github.com/facebook/jest/issues/5258))

Expand Down
14 changes: 14 additions & 0 deletions docs/SnapshotTesting.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,20 @@ You can try out this functionality by cloning the
[snapshot example](https://github.com/facebook/jest/tree/master/examples/snapshot),
modifying the `Link` component, and running Jest.

#### Interactive Updates

Snapshots can also be updated one at a time in the Jest watch mode:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not entirely true, as interaction with snapshots happens test file by test file, not test by test. Can you fix the description to be more accurate (including the paragraph below)?
We'd like to avoid issues about this feature not working as expected (but we'll get there eventually)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thymikee good catch, this is my bad as it's in my copy above

Related to this, the skip option still says "Press s to skip the current snapshot"


![](/jest/img/content/interactiveSnapshot.png)

Once you enter the Interactive Snapshot Updates mode, Jest will walk you though
the failed snapshots one at a time and give you an opportunity to review the
failed output.

From here you can choose to update that snapshot or skip to the next:

![](/jest/img/content/interactiveSnapshotUpdate.png)

### Tests Should Be Deterministic

Your tests should be deterministic. That is, running the same tests multiple
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.