Constructors

Properties

writeSnapshot: boolean = false

Accessors

  • get cleanSnapshot(): undefined | ((snapshotData: string) => string)
  • 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 undefined | ((snapshotData: string) => string)

  • set cleanSnapshot(clean): void
  • Parameters

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

    Returns void

  • get formatSnapshot(): undefined | ((obj: any) => any)
  • 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 undefined | ((obj: any) => any)

  • set formatSnapshot(format): void
  • Parameters

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

    Returns void

Assertion Methods

  • 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>)
    • Rest...__namedParameters: MessageExtra

    Returns Promise<boolean>