Skip to content

Commit af19110

Browse files
geninthorickhanlonii
authored andcommitted
Documentation for Interactive Snapshot Update (#5291)
* 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
1 parent f29c03e commit af19110

File tree

6 files changed

+18
-5
lines changed

6 files changed

+18
-5
lines changed

CHANGELOG.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
`assert`, `count`, `countReset`, `dir`, `dirxml`, `group`, `groupCollapsed`,
77
`groupEnd`, `time`, `timeEnd`
88
([#5514](https://github.com/facebook/jest/pull/5514))
9+
* `[docs]` Add documentation for interactive snapshot mode ([#5291](https://github.com/facebook/jest/pull/5291))
910

1011
## jest 22.2.2
1112

@@ -143,6 +144,7 @@
143144
* `[jest-cli]` Make Jest exit without an error when no tests are found in the
144145
case of `--lastCommit`, `--findRelatedTests`, or `--onlyChanged` options
145146
having been passed to the CLI
147+
* `[jest-cli]` Add interactive snapshot mode ([#3831](https://github.com/facebook/jest/pull/3831))
146148

147149
### Fixes
148150

@@ -171,9 +173,6 @@
171173
([#5279](https://github.com/facebook/jest/pull/5279))
172174
* `[jest-config]` Fix breaking change in `--testPathPattern`
173175
([#5269](https://github.com/facebook/jest/pull/5269))
174-
175-
### Fixes
176-
177176
* `[docs]` Document caveat with mocks, Enzyme, snapshots and React 16
178177
([#5258](https://github.com/facebook/jest/issues/5258))
179178

docs/SnapshotTesting.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,20 @@ You can try out this functionality by cloning the
121121
[snapshot example](https://github.com/facebook/jest/tree/master/examples/snapshot),
122122
modifying the `Link` component, and running Jest.
123123

124+
### Interactive Snapshot Mode
125+
126+
Failed snapshots can also be updated interactively in watch mode:
127+
128+
![](/jest/img/content/interactiveSnapshot.png)
129+
130+
Once you enter Interactive Snapshot Mode, Jest will step you through
131+
the failed snapshots one test suite at a time and give you the opportunity to
132+
review the failed output.
133+
134+
From here you can choose to update that snapshot or skip to the next:
135+
136+
![](/jest/img/content/interactiveSnapshotUpdate.gif)
137+
124138
### Tests Should Be Deterministic
125139

126140
Your tests should be deterministic. That is, running the same tests multiple

packages/jest-cli/src/__tests__/__snapshots__/snapshot_interactive_mode.test.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ exports[`SnapshotInteractiveMode updateWithResults overlay handle progress UI 1`
1212
1313
<bold>Watch Usage</>
1414
<dim> › Press </>u<dim> to update failing snapshots for this test.</>
15-
<dim> › Press </>s<dim> to skip the current snapshot.</>
15+
<dim> › Press </>s<dim> to skip the current test suite.</>
1616
<dim> › Press </>q<dim> to quit Interactive Snapshot Update Mode.</>
1717
<dim> › Press </>Enter<dim> to trigger a test run.</>
1818
"

packages/jest-cli/src/snapshot_interactive_mode.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export default class SnapshotInteractiveMode {
5454
this._testFilePaths.length > 1
5555
? chalk.dim(' \u203A Press ') +
5656
's' +
57-
chalk.dim(' to skip the current snapshot.')
57+
chalk.dim(' to skip the current test suite.')
5858
: '',
5959

6060
chalk.dim(' \u203A Press ') +
Loading
Loading

0 commit comments

Comments
 (0)