-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
bugSomething isn't workingSomething isn't working
Description
When using jest.fn()
from jest with a mocked implementation, the call count is eagerly updated and can be asserted against inside the implementation callback. The exodus-test
implementation of jest.fn()
does not do that as it depends on node's mock.fn()
which only updates the call count after the callback returns.
To demonstrate the issue, the below logs a call count of 0
:
import { mock } from 'node:test'
const mockedFn = mock.fn(() => {
console.log(mockedFn.mock.callCount())
})
mockedFn()
The following (using jest's impl) however logs a call count of 1
:
const mockedFn = jest.fn(() => {
console.log(mockedFn.mock.calls.length)
})
mockedFn()
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working