Update Jest Snapshot Tests within IntelliJ IDEA

Viewed 1368

Recent versions of IntelliJ IDEA support the execution of Jest tests. I couldn't find an option (or even better a shortcut) to update snapshot tests within IntelliJ IDEA.

Is there an option/shortcut to update snapshots within IntelliJ IDEA?

3 Answers

What I have been doing is to right click on the failing Jest test and select the Create option in the pop-up menu to create a new run configuration for just that failing test.

I then add -u to the Jest options and run that specific test (once) to update the snapshot.

It is far from ideal, but you can keep them around for later, if you like, to re-run them with the -u option when needed.

Adding the -u option

I was wondering the same thing and I asked Jetbrains. They said this feature was requested and you can track the status of it here: https://youtrack.jetbrains.com/issue/WEB-26008

I'm not sure when it will be complete but looks like it is on their radar.

Related