Node TAP
    Preparing search index...

    Class SnapshotPlugin

    Index
    writeSnapshot: boolean = false
    • get cleanSnapshot(): ((snapshotData: string) => string) | undefined

      Method that will be called on snapshot strings. This can be used to remove transient run-specific data from snapshots using simple string transforms.

      Returns ((snapshotData: string) => string) | undefined

    • set cleanSnapshot(clean: ((snapshotData: string) => string) | undefined): void

      Parameters

      • clean: ((snapshotData: string) => string) | undefined

      Returns void

    • get formatSnapshot(): ((obj: any) => any) | undefined

      Function that turns an object into a snapshot string.

      By default tcompare!format is used. If a string is returned, then that string is the snapshot string. If any other type is returned, then the returned value will be formatted using tcompare!format.

      Returns ((obj: any) => any) | undefined

    • set formatSnapshot(format: ((obj: any) => any) | undefined): void

      Parameters

      • format: ((obj: any) => any) | undefined

      Returns void

    • get snapshotFile(): string

      The file where snapshots will be written to and read from

      Returns string

    • set snapshotFile(f: string | URL): void

      Parameters

      • f: string | URL

      Returns void

    • In --snapshot mode, takes a snapshot of the object provided, and writes to the snapshot file.

      Otherwise, reads the snapshot file, and verifies that a snapshot of the object provided matches the stored snapshot.

      Parameters

      Returns boolean

    • Resolve a promise, and verify that the resulting value matches the snapshot.

      Type Parameters

      • T extends unknown = any

      Parameters

      • fnOrPromise: Promise<T> | (() => Promise<T>)
      • ...__namedParameters: MessageExtra

      Returns Promise<boolean>