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
I made a mini repo to reproduce the issue. This is to reopen #14443
Expected behavior
I expect this test to pass
/* in __mocks__ folder, lodash is mocked by the file below lodash.ts */import*asexportsFromIndexFilefrom"./index";import{range}from'lodash'letindexModule : typeofexportsFromIndexFilebeforeEach(()=>{jest.isolateModules(()=>{indexModule=require('./index')})})it('mocks for a library in node_modules are not working',()=>{indexModule.helloWorld().// helloWorld is using lodash.range inside expect(range).toHaveBeenCalled()});
Actual behavior
But expect(range).toHaveBeenCalled() failed. It says lodash.range was not called. If I use debugger, I can see that the it's been called.
Version
27.2.1 & 29.6.2 & 29.6.3
Steps to reproduce
I made a mini repo to reproduce the issue. This is to reopen #14443
Expected behavior
I expect this test to pass
Actual behavior
But
expect(range).toHaveBeenCalled()
failed. It sayslodash.range
was not called. If I use debugger, I can see that the it's been called.Additional context
No response
Environment
The text was updated successfully, but these errors were encountered: