Open jentyk opened 3 years ago
To elaborate on this some more:
When a snapshot is stored (or matched, and none exists, and store
is called), a reference is stored. This reference is formatted into a representation during tearDownClass
. This means that if things are active during the comparison (like context managers), they may not be active when the snapshot is written. (we use a context manager to normalize Django model reprs so we can ignore things like FK columns).
I think the fix may be to format the data when it's stored, rather than on save.
this is a duplicate of https://github.com/syrusakbary/snapshottest/issues/99
I know that title sounds a bit silly, but what I meant is that when the "assert_match" method is run, what should be recorded is a copy of the data, not a reference. It seems that currently what is being recorded is a reference and at the moment of saving the whole snapshot file if the same property is snapshotted twice and it changes in the meantime only the latest value is being saved twice.