我尝试在玩笑中使用自动模拟,但出现此错误:
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",
}