Node TAP
    Preparing search index...

    Variable capture

    capture: <T extends {}, M extends string | number | symbol>(
        obj: T,
        method: M,
        impl?: (this: T, ...a: any[]) => any,
    ) => CaptureResultsMethod<T, M>

    Type Declaration

      • <T extends {}, M extends string | number | symbol>(
            obj: T,
            method: M,
            impl?: (this: T, ...a: any[]) => any,
        ): CaptureResultsMethod<T, M>
      • Intercept calls to a method to track the arguments, call site, and return/throw status, and replace the implementation.

        By default, the method is set to a no-op. To retain the method behavior, pass the current value of the method as the third argument. For example:

        const results = t.capture(obj, 'foo', obj.foo)
        

        Automatically restores at t.teardown() if the @tapjs/after plugin is not disabled. Otherwise, it is important to call the restore() method on the returned function when you are done capturing.

        Type Parameters

        • T extends {}
        • M extends string | number | symbol

        Parameters

        • obj: T
        • method: M
        • Optionalimpl: (this: T, ...a: any[]) => any

        Returns CaptureResultsMethod<T, M>