Skip to content

Updating Snapshots After Commit in Watch Mode #6191

@r-walsh

Description

@r-walsh

🐛 Bug Report

After committing changes without updating snapshots it is no longer possible to update those snapshots in watch mode.

It is an easy enough problem to work around by cancelling the watch and running jest -u, but I find I still bump into it every now and again.

To Reproduce

Steps to reproduce the behavior:

  1. Commit changes to a function that is tested via snapshot without updating the snapshots
  2. Run jest --watch and input a when prompted to run the full suite
  3. The tests will fail (as expected) on the out of date snapshot
  4. Input u to update snapshots
  5. Jest will log that no changes were found and not update any snapshots
No tests found related to files changed since last commit.
Press `a` to run all tests, or run Jest with `--watchAll`.

Watch Usage: Press w to show more.

Expected behavior

I expected Jest to update the failed snapshots from the previous run.

Link to repl or repo (highly encouraged)

https://github.com/r-walsh/jest-snapshot-update-bug
The above repo already has changes committed with out of date snapshots, so start at 2 in the reproduction steps.

Run npx envinfo --preset jest

  System:
    OS: macOS Sierra 10.12.6
    CPU: x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
  Binaries:
    Node: 8.9.4 - /usr/local/bin/node
    Yarn: 1.5.1 - /usr/local/bin/yarn
    npm: 6.0.0 - /usr/local/bin/npm
  npmPackages:
    jest: ^22.4.3 => 22.4.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions