Skip to content

Commit

Permalink
Documentation for Interactive Snapshot Update (#5291)
Browse files Browse the repository at this point in the history
* add changelog record for #3831

* nicer description

* new section in snapshot doc about interactive mode

* optimized screen shot

* document itself in changelog

* replace png by gif

* fix description

* typos

* Move changelog update to master

* Updates to changelog language

* Minor language updates

* rm "the"

* s/file/suite
  • Loading branch information
genintho authored and rickhanlonii committed Feb 10, 2018
1 parent f29c03e commit af19110
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 5 deletions.
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
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit af19110

Please sign in to comment.