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 9 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
8 changes: 5 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
not generate additional (invalid) paths by prepending each ancestor of `cwd`
to the absolute path. Additionally, this fixes functionality in Windows OS.
([#5398](https://github.com/facebook/jest/pull/5398))
* `[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.4

Expand Down Expand Up @@ -85,6 +87,9 @@
* `[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

Expand Down Expand Up @@ -113,9 +118,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

The snapshots of one test file can be updated in the Jest watch mode:

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

Once you enter the Interactive Snapshot Updates mode, Jest will walk you though
the failed snapshots of one test file at a time and give you an opportunity to
Copy link
Member

Choose a reason for hiding this comment

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

I think there's an extra "of" here - should be:

Jest will walk you through the failed snapshots one test file at a time...

Also though is a typo, should be through

review the failed output.

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

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

### Tests Should Be Deterministic

Your tests should be deterministic. That is, running the same tests multiple
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ exports[`SnapshotInteractiveMode updateWithResults overlay handle progress UI 1`

<bold>Watch Usage</>
<dim> › Press </>u<dim> to update failing snapshots for this test.</>
<dim> › Press </>s<dim> to skip the current snapshot.</>
<dim> › Press </>s<dim> to skip the current test file.</>
<dim> › Press </>q<dim> to quit Interactive Snapshot Update Mode.</>
<dim> › Press </>Enter<dim> to trigger a test run.</>
"
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-cli/src/snapshot_interactive_mode.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default class SnapshotInteractiveMode {
this._testFilePaths.length > 1
? chalk.dim(' \u203A Press ') +
's' +
chalk.dim(' to skip the current snapshot.')
chalk.dim(' to skip the current test file.')
: '',

chalk.dim(' \u203A Press ') +
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.