Replies: 1 comment 2 replies
-
There was a similar request on discord recently https://discord.com/channels/917386801235247114/1300883544314351677 and this is one way to do that currently using |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Context
In our code we currently do a lot of end-to-end tests. This is because much of our logic is towards a third party system, and the main source of errors is typically in integrating with this third party system. It has all kinds of weird constraints that you won't discover if you mock it out.
But as we're expanding our test suite, it is becoming slower and slower (obviously). We want to try to find a way to strike a good balance between still having the effect of end-to-end, but faster.
As part of that, what we're thinking of doing is snapshot testing. We already do this, but we also want to have the concept of "input snapshots".
So let's say I create a test which creates a user in the third party system via an API call. We want to make it so that the first time it does this, it makes a real call, and saves the result in a snapshot file.
Then the next time, it is loaded from the snapshot file.
If someone then runs "Update snapshots" in Vitest, we want it to update the results again, as if it was the first time that this ran.
Ask
Does Vitest provide any mechanism for detecting if "update snapshot" has been run? Does a particular environment variable get set?
Beta Was this translation helpful? Give feedback.
All reactions