SelfieSettingsAPI
If you create a class named SelfieSettings
in the package selfie
, it must extend this class, and you can override the methods below to customize various behaviors of selfie. You can also put the settings class somewhere else if you set the selfie.settings
system property to the fully qualified name of the class you want selfie to use.
Properties
It's possible that multiple codepaths from multiple tests can end up writing a single snapshot to a single location. If all these codepaths are writing the same value, it's fine. But it's a bit of a problem waiting to happen, because if they start writing different values, we'll have a "snapshot error" even within a single invocation, so it can't be resolved by updating the snapshot. By default we let this happen and give a nice error message if it goes wrong, but you can disallow it in the first place if you want.
By default, Selfie will encode multiline strings using triple quotes if the runtime supports it, or it will use comma-delimited single-quote strings if the runtime doesn't. This can cause a problem if you develop on Java 17 (and generate toBe
assertions there) and then run your tests in CI on Java 11.
If Selfie should look for test sourcecode in places other than the rootFolder, you can specify them here. Selfie will not store snapshots in these folders.
By default, the root folder is the first of the standard test directories. All snapshots are stored within the root folder.
Defaults to null, which means that snapshots are stored right next to the test that created them. Set to __snapshots__
to mimic Jest behavior.