You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
jest.createMockFromModule()/jest..getMockFromModule(moduleName) -> use vi.mock or vi.importMock
jest.mock(moduleName, factory, options)
jest.doMock(moduleName, factory, options) - not supported, since static imports won't work then. if you need dynamic import, you can use vi.importMock. may support in the future if needed
I think this is an interesting idea, but not a part of this issue, I'm afraid. If you want this to be implemented, you can create another issue. We can discuss it there. For now closing this, since all APIs are implemented now.
https://jestjs.io/docs/27.2/jest-object#mock-modules
extending #185
jest.disableAutomock()
jest.enableAutomock()
-> usejest.createMockFromModule()
/jest..getMockFromModule(moduleName)
vi.mock
orvi.importMock
jest.mock(moduleName, factory, options)
- not supported, since static imports won't work then. if you need dynamic import, you can usejest.doMock(moduleName, factory, options)
vi.importMock
. may support in the future if neededjest.unmock(moduleName)
/jest.dontMock(moduleName)
-> usejest.setMock(moduleName, moduleExports)
vi.mock
jest.requireActual(moduleName)
->vi.importActual
jest.requireMock(moduleName)
->vi.importMock
jest.mocked<T>(item: T, deep = false)
Current
vitest
implementation does not support automocking, so these functions are left out:jest.disableAutomock()
- not sure if we should support automocking, it's a very confusing feature for usersjest.enableAutomock()
Not really a part of this issue:
jest.resetModules()
jest.isolateModules(fn)
The text was updated successfully, but these errors were encountered: