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

x/molt/lib/std/testing.ts>Spy

Update dependencies the Deno way
Latest
interface Spy
import { type Spy } from "https://deno.land/x/molt@0.17.2/lib/std/testing.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.