1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
x1 x1 x1 x1 x1 x1 x1 x1 x1 x1 x1 x1 x1 x1 |
import type { SnapshotMode as _typeAlias_SnapshotMode } from "jsr:@std/[email protected]/snapshot"
/**
* The mode of snapshot testing.
*/
type SnapshotMode = _typeAlias_SnapshotMode
export type { SnapshotMode }
import type { SnapshotOptions as _typeAlias_SnapshotOptions } from "jsr:@std/[email protected]/snapshot"
/**
* The options for {@linkcode assertSnapshot}.
*/
type SnapshotOptions<T = unknown> = _typeAlias_SnapshotOptions<T>
export type { SnapshotOptions }
import { serialize as _function_serialize } from "jsr:@std/[email protected]/snapshot"
/**
* Default serializer for `assertSnapshot`.
*
* @example Usage
* ```ts
* import { serialize } from "@std/testing/snapshot";
* import { assertEquals } from "@std/assert";
*
* assertEquals(serialize({ foo: 42 }), "{\n foo: 42,\n}")
* ```
*
* @param actual The value to serialize
* @return The serialized string
*/
const serialize = _function_serialize as typeof _function_serialize
export { serialize }
import { assertSnapshot as _function_assertSnapshot } from "jsr:@std/[email protected]/snapshot"
/** UNDOCUMENTED */
const assertSnapshot = _function_assertSnapshot as typeof _function_assertSnapshot
export { assertSnapshot }
import { createAssertSnapshot as _function_createAssertSnapshot } from "jsr:@std/[email protected]/snapshot"
/**
* Create {@linkcode assertSnapshot} function with the given options.
*
* The specified option becomes the default for returned {@linkcode assertSnapshot}
*
* @example Usage
* ```ts
* import { createAssertSnapshot } from "@std/testing/snapshot";
*
* const assertSnapshot = createAssertSnapshot({
* // Uses the custom directory for saving snapshot files.
* dir: "my_snapshot_dir",
* });
*
* Deno.test("a snapshot test case", async (t) => {
* await assertSnapshot(t, {
* foo: "Hello",
* bar: "World",
* });
* })
* ```
*
* @template T The type of the snapshot
* @param options The options
* @param baseAssertSnapshot {@linkcode assertSnapshot} function implementation. Default to the original {@linkcode assertSnapshot}
* @return function with the given default options.
*/
const createAssertSnapshot = _function_createAssertSnapshot as typeof _function_createAssertSnapshot
export { createAssertSnapshot }
|