[英]npm E2E test is getting timed out when running in Docker but getting passed when running on local machine
[英]Ignore e2e folder when running npm test
我正在使用排毒作为我的react-native应用程序的end-2-end测试器,但是我不希望在运行npm test时将e2e文件夹中的内容包括在内。 我目前正在对npm测试使用笑话。
这就是我的package.json中的内容:
"jest": {
"preset": "react-native",
"transformIgnorePatterns": [
"node_modules/(?!(react-native|static-container|expo|@expo|react-navigation))"
]
},
e2e文件夹位于我的根目录中,而我的测试文件也位于我的根目录中的tests文件夹中。
为了在我执行笑话测试时解决此问题,我使用testMatch属性并将其设置在package.json
这意味着它将仅与我指定的文件夹中的测试匹配。
"jest": {
"preset": "react-native",
"testMatch": [
"<rootDir>/__tests__/**/*.test.js?(x)",
"<rootDir>/app/**/*.test.js"
]
},
或者,您可以使用忽略特定路径。
"jest": {
"preset": "react-native",
"testPathIgnorePatterns": [
"<rootDir>/e2e"
]
},
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.