开玩笑的自动模拟无法正常工作

时间:2020-10-22 14:52:22

标签: jestjs automocking

我尝试在玩笑中使用自动模拟,但出现此错误:

TypeError: Cannot read property 'default' of undefined

  23 |   
  24 | 
> 25 |   console.log(utils);
     |               ^
  26 | });
  27 | 
  28 | xit("asda", () => {

request.js

export const a = 4;

测试文件

import utils from "./request";


it("works with promises", async () => {

  console.log(utils);
});

配置

"jest": "^26.5.3",
"jest-environment-jsdom-sixteen": "1.0.3",

 "jest": {
    "automock": true,
    "roots": [
      "<rootDir>"
    ],
    "testEnvironment": "jest-environment-jsdom-sixteen",
}

0 个答案:

没有答案