Type Alias SnapshotOptions<T>
dir?: string;
mode?: SnapshotMode;
msg?: string;
name?: string;
path?: string;
serializer?: ((actual: T) => string);
}
Type Parameters
Type declaration
Optionaldir?: stringSnapshot output directory. Snapshot files will be written to this directory. This can be relative to the test directory or an absolute path.
If both
dirandpathare specified, thediroption will be ignored and thepathoption will be handled as normal.Optionalmode?: SnapshotModeSnapshot mode. Defaults to
assert, unless the-uor--updateflag is passed, in which case this will be set toupdate. This option takes higher priority than the update flag. If the--updateflag is passed, it will be ignored if themodeoption is set.Optionalmsg?: stringFailure message to log when the assertion fails. Specifying this option will cause the diff not to be logged.
Optionalname?: stringName of the snapshot to use in the snapshot file.
Optionalpath?: stringSnapshot output path. The snapshot will be written to this file. This can be a path relative to the test directory or an absolute path.
If both
dirandpathare specified, thediroption will be ignored and thepathoption will be handled as normal.Optionalserializer?: ((actual: T) => string)Function to use when serializing the snapshot. The default is
serialize.- (actual): string
Parameters
- actual: T
Returns string
The options for
assertSnapshot.