SelfieSettingsAPI

To change the default settings, you must pass an instance of this class to the SelfieExtension in its constructor. The magic class selfie.SelfieSettings that selfie-runner-junit5 uses does not work with the multiplatform in selfie-runner-kotest

  • you have to pass the settings explicitly.

Constructors

Link copied to clipboard
constructor()

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.

Link copied to clipboard

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.

Link copied to clipboard
open val otherSourceRoots: List<Path>

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.

Link copied to clipboard
open val rootFolder: Path

By default, the root folder is the first of the standard test directories. All snapshots are stored within the root folder.

Link copied to clipboard

Defaults to null, which means that snapshots are stored right next to the test that created them. Set to __snapshots__ to mimic Jest behavior.