Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

std/testing/mock.ts>mockSession

Deno standard library
Go to Latest
The Standard Library has been moved to JSR. See the blog post for details.
function mockSession
import { mockSession } from "https://deno.land/std@0.146.0/testing/mock.ts";

Creates a session that tracks all mocks created before it's restored. If a callback is provided, it restores all mocks created within it.

Returns

number

Type Parameters

Self
Args extends unknown[]
Return

Parameters

func: (this: Self, ...args: Args) => Return

Returns

(this: Self, ...args: Args) => Return

Type Parameters

Self
Args extends unknown[]
Return

Parameters

optional
func: (this: Self, ...args: Args) => Return

Returns

number | ((this: Self, ...args: Args) => Return)