bit icon indicating copy to clipboard operation
bit copied to clipboard

How to update jest snapshots

Open dstoyanoff opened this issue 3 years ago • 2 comments

Hello, We are using Bit + Jest to test our components. Creating a snapshot works fine on the first run. However, we are not sure how to run it with the -u flag.

I've tried to do bit test -path-to-component -- -u, but it doesn't seem to be forwarding the flag to jest.

Can you advise? In addition, is there a way to have setupTests file that we can use to configure jest? I don't see this documented.

Thank you!

dstoyanoff avatar Jul 01 '21 09:07 dstoyanoff

Facing same issue, not able to update snapshots

sandeepkumar03 avatar Jul 13 '22 12:07 sandeepkumar03

same issue too, is there a schedule to resolve this?

blacktail avatar Jul 27 '22 11:07 blacktail

This still needs to be resolved, but I did find a workaround. You can run bit test -w to run jest in watch mode, then press u to update the failing snapshots (or i for interactive)

Watch Usage
 › Press f to run only failed tests.
 › Press o to only run tests related to changed files.
 › Press p to filter by a filename regex pattern.
 › Press t to filter by a test name regex pattern.
 › Press u to update failing snapshots.
 › Press i to update failing snapshots interactively.
 › Press q to quit watch mode.
 › Press Enter to trigger a test run.

todda00 avatar May 17 '23 17:05 todda00