Open
Description
Is your feature request related to a problem? Please describe.
In an event emitter, I want to replace the handler to throw an error, to verify if the emitter can handle error
Describe the solution you'd like
Like node:test
, you can replace the mock implementation with
import { mock } from 'node:test'
mocked_fn = mock.fn()
mocked_fn.mock.mockImplementation(()=>{ /* new logic */ })
Describe alternatives you've considered
make the fn
in spy(fn)
a wrapper, which call an external function variable.