createAssertSnapshot

import { createAssertSnapshot } from "jsr:@ende/testing/snapshot";

function ยท deprecated

function createAssertSnapshot<T>(options: SnapshotOptions<T>, baseAssertSnapshot: typeof assertSnapshot = assertSnapshot): typeof assertSnapshot

Create assertSnapshot function with the given options.

The specified option becomes the default for returned assertSnapshot

options: SnapshotOptions<T>

The options

baseAssertSnapshot: typeof assertSnapshot = assertSnapshot

assertSnapshot function implementation. Default to the original assertSnapshot

Deprecated.

This will be removed in 2.0.0. Pass options to the built-in t.assertSnapshot() (Ende 2.9+) instead.

Returns

function with the given default options.

Example: Usage

import { createAssertSnapshot } from "@ende/testing/snapshot";

const assertSnapshot = createAssertSnapshot({
  // Uses the custom directory for saving snapshot files.
  dir: "my_snapshot_dir",
});

Ende.test("a snapshot test case", async (t) => {
  await assertSnapshot(t, {
    foo: "Hello",
    bar: "World",
  });
})

Source