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
I tried to upgrade a project of mine to 4.0.2 and found that all tests with snapshots started failing after the upgrade. The .snap.debug file created only contains the snapshot of the last test that was executed within a test class.
I made a few tests in a sample project with minimum configuration and found that it doesn't happen if I use the default serializer, just when I use a custom one. The thing is, it used to work with 3.x and, even if I had a bad implementation, I don't think the serializer should be able to break the entire snapshot file.
The issue is that the YAML Serializer is outputting a single blank line at the end of the output. The REGEX used by this library is failing for the SPLIT_STRING (3 new lines) and incorrectly picks up one of these new lines. This doesn't happen for String snapshots because they are bounded by the characters [ & ].
This issue should be fixed once encoding of the snapshot takes place (future update #130) in which blank lines will be escaped.
For now you can simply trim() the YAML output to fix this issue.
If you wan't to keep the New lines at the end of the snapshot. An alternative would be to bound the output between braces [ & ] like the String Serializer does.
Hi,
I tried to upgrade a project of mine to 4.0.2 and found that all tests with snapshots started failing after the upgrade. The
.snap.debug
file created only contains the snapshot of the last test that was executed within a test class.I made a few tests in a sample project with minimum configuration and found that it doesn't happen if I use the default serializer, just when I use a custom one. The thing is, it used to work with 3.x and, even if I had a bad implementation, I don't think the serializer should be able to break the entire snapshot file.
Reproducing the issue
snapshot.properties
:snap.debug
file as follows:Project configuration
My project uses Java 17 (Corretto, latest version).
pom.xml
The text was updated successfully, but these errors were encountered: