Snapshot testing #5159
Unanswered
OliverJAsh
asked this question in
Q&A
Replies: 1 comment
-
So far, there is no way to stabilize it. Each entry added to the record stored in the array will offset the next record "by design". Designed to be efficient for generation cases. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We are using
fast-check
alongside snapshot testing: the data we generate withArbitrary
s and a stable seed ends up being stored in snapshots.When a new property is added to the
Arbitrary
, it seems to change the random data for all other properties. For example:This outputs the following:
Now let's say added new property,
name: fc.string()
:const arb = fc.array( fc.record({ age: fc.integer({ min: 0, max: 20 }), + name: fc.string(), }), { minLength: 5, maxLength: 5 }, );
If we run this again, we can see that
age
is now producing different values:As a result of this, our snapshots need updating very frequently. This can be a huge pain.
Is there any way to make the
Arbitrary
stable so that adding a new property doesn't affect other properties? Or perhaps you would recommend that we shouldn't be usingfast-check
in this way?Beta Was this translation helpful? Give feedback.
All reactions