You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
they are usually bigger and not just flat and small like this, but this will suffice as example.
Now when I have a snapshot assertion it will fail because the timestamp prop is different each time the test is run. This is in some cases solvable by mocking out time, but often I am doing an integration test where the time would have to be mocked on my system level. I am not aware of any reliable way to mock a time on system level-changing it won't help because test execution takes some time and this time is always different.
So my only option currently is to use something like
this works, but it makes it a little tedious to write these assertions. Couldn't we store this information into the snapshots themselves? Like a list of paths in the snapshots that should be skipped when comparing?
Ideally jest should be able to write this upon a snapshot failuire where currently I can press u to update so I would press s or p to skip failed properties.
It should also work for properties which are deeper than on the root of the compared object.
The text was updated successfully, but these errors were encountered:
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.
I often test object from the database-like:
they are usually bigger and not just flat and small like this, but this will suffice as example.
Now when I have a snapshot assertion it will fail because the
timestamp
prop is different each time the test is run. This is in some cases solvable by mocking out time, but often I am doing an integration test where the time would have to be mocked on my system level. I am not aware of any reliable way to mock a time on system level-changing it won't help because test execution takes some time and this time is always different.So my only option currently is to use something like
this works, but it makes it a little tedious to write these assertions. Couldn't we store this information into the snapshots themselves? Like a list of paths in the snapshots that should be skipped when comparing?
Ideally jest should be able to write this upon a snapshot failuire where currently I can press
u
to update so I would presss
orp
to skip failed properties.It should also work for properties which are deeper than on the root of the compared object.
The text was updated successfully, but these errors were encountered: