该项目同时具有客户端应用程序和服务器站点代码,一旦项目在本地构建,它将把所有构建的资产(前端和后端内容)放入build
目录中,它包含客户端需要使用的所有静态资产(所有测试用例)也包括在那里)。
在运行后续测试时,由于多个目录中存在重复的手动模拟,Jest将引发如下所示的警告消息。
jest-haste-map: duplicate manual mock found:
Module name: fileMock
Duplicate Mock path: /Users/x/x/x/x/src/resources/webapp/static/__mocks__/fileMock.js
This warning is caused by two manual mock files with the same file name.
Jest will use the mock file found in:
/Users/x/x/x/x/src/resources/webapp/static/__mocks__/fileMock.js
Please delete one of the following two files:
/Users/x/x/x/x/build/classes/webapp/static/__mocks__/fileMock.js
/Users/x/x/x/x/src/resources/webapp/static/__mocks__/fileMock.js
"jest": {
"modulePathIgnorePatterns": [
"<rootDir>/build"
]
}
将build
文件夹添加到modulePathIgnorePatterns
文件中的package.json
中。