How can I mock an ES6 module import using Jest?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm beginning to think this isn't possible, but I want to ask anyway. I want to test that one of my ES6 modules calls another ES6 module in a particular way. With Jasmine this is super easy -- The app code: // myModule.js import dependency from './dependency'; export default (x) => { dependency.doSomething(x * 2); } And the test code: //myModule-test.js import myModule from '../myModule'; import dependency from '../dependency'; describe('myModule', () => { it('calls the dependency with double the input', () => { spyOn(dependency,