Skip to content
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
4 changes: 3 additions & 1 deletion packages/jest-cli/src/__tests__/watch.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,8 @@ describe('Watch mode flows', () => {
});

it('Pressing "u" reruns the tests in "update snapshot" mode', () => {
globalConfig.updateSnapshot = 'new';

watch(globalConfig, contexts, pipe, hasteMapInstances, stdin);
runJestMock.mockReset();

Expand All @@ -270,7 +272,7 @@ describe('Watch mode flows', () => {
stdin.emit(KEYS.A);
// updateSnapshot is not sticky after a run.
expect(runJestMock.mock.calls[1][0].globalConfig).toMatchObject({
updateSnapshot: 'none',
updateSnapshot: 'new',
watch: false,
});
});
Expand Down
4 changes: 3 additions & 1 deletion packages/jest-cli/src/watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,13 +212,15 @@ export default function watch(
startRun(globalConfig);
break;
case KEYS.U:
const previousUpdateSnapshot = globalConfig.updateSnapshot;

globalConfig = updateGlobalConfig(globalConfig, {
updateSnapshot: 'all',
});
startRun(globalConfig);
globalConfig = updateGlobalConfig(globalConfig, {
// updateSnapshot is not sticky after a run.
updateSnapshot: 'none',
updateSnapshot: previousUpdateSnapshot,
});
break;
case KEYS.A:
Expand Down