Module

std/testing/mock.ts>Spy

Deno standard library
Go to Latest
interface Spy
import { type Spy } from "https://dotland.deno.dev/std@0.181.0/testing/mock.ts";

A function or instance method wrapper that records all calls made to it.

Type Parameters

optional
Self = any
optional
Args extends unknown[] = any[]
optional
Return = any

Call Signatures

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

Properties

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

The function that is being spied on.

calls: SpyCall<Self, Args, Return>[]

Information about calls made to the function or instance method.

restored: boolean

Whether or not the original instance method has been restored.

Methods

restore(): void

If spying on an instance method, this restores the original instance method.