Replies: 1 comment 1 reply
-
Upgrading from
i.e. these classes are now under this |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
To upgrade you need to perform some mechanical refactoring of your code.
snapshot.properties
file in your resources folder with the following contentAbove is your global configuration. Previously you needed to use an annotation to override the global defaults
@UseSnapshotConfig
. This is no longer necessary which prevents the need to constantly apply this annotation to each test class. You can most likely delete any@UseSnapshotConfig
you had before although you can still use it in cases where you need it.Define an instance variable
private Expect expect;
on each test class (Note thatSnapshotMatcher.expect()
no longer exists)Refactor all your verifications from
expect(YOUR_OBJECT).toMatchSnapshot()
to thisexpect.toMatchSnapshot(YOUR_OBJECT)
If you were using
.string()
,.json()
or.orderedJson()
on yourexpect
call, refactor to use their corresponding names fromsnapshot.properties
.Run all tests. None of you existing snapshots should fail - the format has not changed.
Apply the new
@SnapshotName("YOUR_CUSTOM_NAME")
if desired (for spock tests it's required)Beta Was this translation helpful? Give feedback.
All reactions