Skip to content

Automatically rerun tests after updating snapshots. #179

Open
@marcinczenko

Description

@marcinczenko

Environment

  1. node -v: [v9.0.0]

  2. npm -v: [5.5.1], yarn v1.3.2

  3. npm ls react-scripts (if you haven’t ejected): [fill]

  4. Operating system: [[email protected]]

Steps to Reproduce

[Pre-cond]: all tests passing.

  1. Change the code so that there is an expected snapshot failing.
  2. Output shows correct information that there is a snapshot failing and the editor offers replacing the snapshots with the new ones.
  3. Confirm by clicking on Replace them in the Info box.
  4. The info box shows Updated Snapshots. It will show in your next test run..
  5. Close the Info box by clicking on Close button.
  6. The OUTPUT still shows the test failure.
  7. Perform Save on the file that caused the snapshot failure.

Expected Behavior

  1. The relevant tests will re-run and the relevant errors will be cleared in Problems tab.

Actual Behavior

  1. Instead, the OUTPUT sometimes shows: No tests found related to files changed since last commit. Press a to run all tests, or run Jest with --watchAll. In such a case the PROBLEMS tab still shows failing Snapshot test.

It would be nice to get an Option (e.g. via CMD-SHIFT-P) to force re-run all the tests. Otherwise it is hard to clean up the PROBLEMS tab and it is annoying. I see there is an enhancement proposed for just doing this, but this is still not optimal solution for a nice snapshot-testing flow.

A natural behaviour with snapshot testing is to re-run the relevant tests immediately after replacing snapshots. The Updated Snapshots. It will show in your next test run. confirmation is redundant and off-the flow. Also doing 'dummy' save on the file that caused the snapshot failure, hopping to trigger a test rerun is not natural (and it does not always work).

Reseting Jest Runner (Stop/Start) will clear the errors in the PROBLEMS tab, but it is also not how one would like to go through the process.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions