This is basically an open question to all zapatos users: how do you mock zapatos in unit tests? I'm currently trying to find a setup for esm and the native node test runner. The obvious approach of
import { mock } from 'node:test'
import * as db from 'zapatos/db'
mock.method(db, 'select')
does not work due to:
TypeError [Error]: Cannot redefine property: select
at defineProperty (<anonymous>)
at MockTracker.method (node:internal/test_runner/mock/mock:404:5)
Previously I successfully used jest, but want to get rid of it:
This is basically an open question to all zapatos users: how do you mock zapatos in unit tests? I'm currently trying to find a setup for esm and the native node test runner. The obvious approach of
does not work due to:
Previously I successfully used jest, but want to get rid of it:
The native module mocking is still experimental in node and I did not have any success with that either.
So, how do you do it?