| 693 | * (Deno 2.9+) instead. |
| 694 | */ |
| 695 | export function createAssertSnapshot<T>( |
| 696 | options: SnapshotOptions<T>, |
| 697 | baseAssertSnapshot: typeof assertSnapshot = assertSnapshot, |
| 698 | ): typeof assertSnapshot { |
| 699 | return async function ( |
| 700 | context: Deno.TestContext, |
| 701 | actual: T, |
| 702 | messageOrOptions?: string | SnapshotOptions<T>, |
| 703 | ) { |
| 704 | const mergedOptions: SnapshotOptions<T> = { |
| 705 | ...options, |
| 706 | ...(typeof messageOrOptions === "string" |
| 707 | ? { |
| 708 | msg: messageOrOptions, |
| 709 | } |
| 710 | : messageOrOptions), |
| 711 | }; |
| 712 | |
| 713 | await baseAssertSnapshot(context, actual, mergedOptions); |
| 714 | }; |
| 715 | } |