std/testing/snapshot.ts

Deno standard library
Go to Latest
function assertSnapshot
import { assertSnapshot } from "https://deno.land/std@0.146.0/testing/snapshot.ts?s=assertSnapshot";

Make an assertion that actual matches a snapshot. If the snapshot and actual do not a match, then throw.

Type parameter can be specified to ensure values under comparison have the same type. For example:

import { assertSnapshot } from "./snapshot.ts";

Deno.test("snapshot", async (test) => {
 await assertSnapshot<number>(test, 2);
});

Parameters

t: Deno.TestContext[src]
actual: T[src]
options: SnapshotOptions<T>[src]

Returns

Promise<void>[src]

Parameters

context: Deno.TestContext[src]
actual: T[src]
optional
message: string
[src]

Returns

Promise<void>[src]

Parameters

context: Deno.TestContext[src]
actual: unknown[src]
optional
msgOrOpts: string | SnapshotOptions<unknown>
[src]

Returns

Promise<void>[src]