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 all 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
5 changes: 2 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
`assert`, `count`, `countReset`, `dir`, `dirxml`, `group`, `groupCollapsed`,
`groupEnd`, `time`, `timeEnd`
([#5514](https://github.com/facebook/jest/pull/5514))
* `[docs]` Add documentation for interactive snapshot mode ([#5291](https://github.com/facebook/jest/pull/5291))

## jest 22.2.2

Expand Down Expand Up @@ -143,6 +144,7 @@
* `[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]` Add interactive snapshot mode ([#3831](https://github.com/facebook/jest/pull/3831))

### Fixes

Expand Down Expand Up @@ -171,9 +173,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 Snapshot Mode

Failed snapshots can also be updated interactively in watch mode:

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

Once you enter Interactive Snapshot Mode, Jest will step you through
the failed snapshots one test suite at a time and give you the opportunity to
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 suite.</>
<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 suite.')
: '',

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.