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

x/rimbu/spy/spy.ts>Spy.ClsMeta

Rimbu is a TypeScript library focused on immutable, performant, and type-safe collections and other tools.
Go to Latest
interface Spy.ClsMeta
import { type Spy } from "https://deno.land/x/rimbu@1.2.0/spy/spy.ts";
const { ClsMeta } = Spy;

The metadata object type for a spied class.

Type Parameters

C
A extends any[]

Methods

getter
nrInstances(): number

Returns the number of class instances created from the spy.

getter
instances(): Spy.ClsObj<C, A>[]

Returns an array of class instance metadata objects containing all instances created from the spy class.

getter
constructorCalls(): A[]

Returns an array of received constructor call parameters.

clearInstances(): void

Empties the history of created spy class instances.

resetAllStubs(): void

Resets the current spy class constructor stub and all the instances method stubs.

resetInstanceStubs(): void

Resets all the current instance method stubs.

setConstructorStub(constructor: Func<A, C> | undefined): void

Sets the used constructor stub function for new instances of the spy class.

resetConstructorStub(): void

Resets the used constructor to the originally given constructor.