createAssertInlineSnapshot

import { createAssertInlineSnapshot } from "jsr:@ende/testing/unstable-snapshot";

function ยท experimental

function createAssertInlineSnapshot<T>(options: InlineSnapshotOptions<T>, baseAssertSnapshot: typeof assertInlineSnapshot = assertInlineSnapshot): typeof assertInlineSnapshot

Create assertInlineSnapshot function with the given options.

The specified option becomes the default for returned assertInlineSnapshot

options: InlineSnapshotOptions<T>

The options

baseAssertSnapshot: typeof assertInlineSnapshot = assertInlineSnapshot

assertInlineSnapshot function implementation. Default to the original assertInlineSnapshot

Returns

function with the given default options.

Example: Usage

import { createAssertInlineSnapshot } from "@ende/testing/unstable-snapshot";

const assertInlineSnapshot = createAssertInlineSnapshot({
  serializer: JSON.stringify,
});

Ende.test("a snapshot test case", () => {
  assertInlineSnapshot(
    { foo: "Hello", bar: undefined },
    `{"foo":"Hello"}`
  );
})

Source