interface SnapshotOptions {
    cleanSnapshot?: ((snapshotData) => string);
    compareOptions?: CompareOptions;
    formatSnapshot?: ((obj) => any);
    snapshotFile?: string;
    snapshotProvider?: (new (file) => SnapshotProvider);
    writeSnapshot?: boolean;
}

Properties

cleanSnapshot?: ((snapshotData) => string)

Function called on the string snapshot result, can be used to remove changeable data, platform-specific stuff, etc.

Type declaration

    • (snapshotData): string
    • Parameters

      • snapshotData: string

      Returns string

compareOptions?: CompareOptions
formatSnapshot?: ((obj) => any)

Function used to serialize snapshotted objects to a string. If a non-string is returned, then the default formatting will be used, so this can also transform the object, if needed.

Type declaration

    • (obj): any
    • Parameters

      • obj: any

      Returns any

snapshotFile?: string

the "file" used to store snapshots. Defaults to a filename based on the test file name and arguments, in ./tap-snapshots. Specifying the same filename will result in getting the same SnapshotProvider.

snapshotProvider?: (new (file) => SnapshotProvider)

Class to use to store and load snapshot data. Defaults to SnapshotProviderDefault, which writes to files in ./tap-snapshots There's no hard requirement that "file" be a file on disk of course. Could easily be in a database, localStorage, whatever.

Type declaration

writeSnapshot?: boolean

whether or not to write the snapshot file. Defaults true if TAP_SNAPSHOT=1 in the environment.

Generated using TypeDoc