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

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

Update dependencies the Deno way
Latest
interface ConstructorSpy
import { type ConstructorSpy } from "https://deno.land/x/molt@0.17.2/lib/std/testing.ts";

A constructor wrapper that records all calls made to it.

Type Parameters

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

Properties

original: new (...args: Args) => Self

The function that is being spied on.

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

Information about calls made to the function or instance method.

restored: boolean

Whether or not the original instance method has been restored.

Methods

new(...args: Args): Self
restore(): void

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