Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update failing snapshots [HOW TO] #276

Open
albert-olive opened this issue Feb 28, 2018 · 12 comments
Open

Update failing snapshots [HOW TO] #276

albert-olive opened this issue Feb 28, 2018 · 12 comments

Comments

@albert-olive
Copy link

Hi, I don't find any documentation so that's why I'm asking this question:

How do I update failing snapshots? I see that message but I don't know were to press u.

› 2 snapshot tests failed in 1 test suite. Inspect your code changes or press u to update them.

Thanks

@orta
Copy link
Member

orta commented Feb 28, 2018

There is a dropdown to update snapshots in the editor when that text is detected.

@seanpoulter
Copy link
Member

Could you submit a PR with the docs you'd like to see @albert-olive?

@JasonSooter
Copy link

JasonSooter commented Jun 15, 2018

@seanpoulter I'd gladly submit the PR with the docs if @orta can direct me to the dropdown. I don't see a dropdown anywhere and it doesn't update on save of the test or file that caused the need for snapshot update.

@orta
Copy link
Member

orta commented Jun 16, 2018

There is/used to be a notification that asks if you want to replace them in the editor

@JasonSooter
Copy link

I see it occasionally but not necessarily when I need it to. I can comment out an expect. Save. Uncomment the expect and it will then prompt me. But is there a way to update without depending on the prompt?

@adambraimbridge
Copy link

adambraimbridge commented Aug 23, 2018

I'm also experiencing this absence of the "dropdown to update snapshots in the editor".

I used to see it, but now it no longer displays. Is this a known issue?

image

Above: I get "New snapshot is ready to write", but no means within VSCode of writing it.

@randycoulman
Copy link

This seems to have been fixed in #356, but there hasn't been a release with that fix in it yet.

@Eidher
Copy link

Eidher commented Apr 11, 2019

On release 2.9.2 there's an option to Restart Jest On Snapshot Update, this worked for me.

Screen Shot 2019-04-11 at 12 38 51 AM

Here's an extended explanation:
#215

@viceice
Copy link

viceice commented May 22, 2019

Snapshot update should use onlyChanged flag, this will only run required test.

otherwise it will run all tests, which could need a huge amount of time

@Bnaya
Copy link

Bnaya commented Sep 8, 2019

I'm also sometimes gets:
Screen Shot 2019-09-08 at 13 41 45
Without the "update snapshot" prompt.

@betadayz
Copy link

how do i update my snapshot?

@yepitschunked
Copy link

@orta

There is a dropdown to update snapshots in the editor when that text is detected.

It looks like that's implemented by the regex here:

const SnapshotFailRegex = /(snapshots? failed)|(snapshot test failed)/i;

However, the text it's looking for seems to only get printed in certain cases, based on some random criteria in jest (e.g this issue suggests you have to run >20 tests: jestjs/jest#3322)

So I think all the people complaining in this thread about no update snapshot prompt are running into the issue where jest is not printing that summary out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests