我正在尝试让jest mocking在相对路径上工作。相同的代码,但是使用模拟fs工作得很好,所以我不确定为什么尝试模拟我自己的模块不能工作const { cacheFile } = require('./cacheHandler.js')
it("should be able to spy on the function&qu
我尝试用以下方法模拟一个功能组件(使用Hooks):但是它抛出了这个错误:
file.js: babel-plugin-jest-hoist:The module factory of `jest.mock()` is not allowed to reference any out-of-scope variables