rrhrg
rrhrg

Reputation: 1250

Update Jest Snapshot Tests within IntelliJ IDEA

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?

Upvotes: 3

Views: 2005

Answers (3)

Nebu
Nebu

Reputation: 1362

The -u option can be applied as a Jest run config default if you want it to be active for all Jest tests.

Upvotes: 0

Adriel Klein
Adriel Klein

Reputation: 143

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.

Upvotes: 0

Michael Oryl
Michael Oryl

Reputation: 21642

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

Upvotes: 5

Related Questions