mock
function from bun:test
.
The mock function can accept arguments.
The result of
mock()
is a new function that’s been decorated with some additional properties.
These extra properties make it possible to write
expect
assertions about usage of the mock function, including how many times it was called, the arguments, and the return values.
See Docs > Test Runner > Mocks for complete documentation on mocking with the Bun test runner.