如何将文件排除在伊斯坦布尔纽约市覆盖范围报告中
我只是想让基本的伊斯坦布尔纽约市排除在项目上工作的功能,但到目前为止我还不能。
我正在使用柏树在我的react.js应用程序上运行E2E测试。我的覆盖范围报告似乎还不错,除了不忽略我的排除数组中的文件。
我已经尝试将其添加到我的package.json
文件:
"nyc": {
"exclude": [
"AddressFormatter.js"
]
}
我尝试包括完整路径名src/contements/components/addressFormatter
以及**/advericalFormatter。 JS
。
我还尝试使用以下内容使用.nycrc.json
:
{
"reporter": ["lcov", "text-summary"],
"sourceMap": true,
"instrument": true,
"temp-dir": "app/test/.nyc_output",
"report-dir": "app/test/coverage",
"all": true,
"exclude": ["**/AddressFormatter.js"],
"check-coverage": true
}
找到此问题的步骤。从终端i RAN
YARN ADD -D @CYPRESS/CODE -COVERAGE
然后我运行
YARN add -d nyc
接下来我ran ran ran
nyc nyc仪器./src ./覆盖范围
最后我更新了package.json
用
“ start”启动脚本:“ react-scripts -r @cypress/instrument-cra启动“
之后,我尝试了上述所有方法来获取我的覆盖范围报告以忽略不同的文件。
到目前为止,我还没有成功忽略此文件。任何建议将不胜感激。
I am just trying to get the basic Istanbul nyc exclude functionality working on my project but so far I cannot.
I am using Cypress to run e2e test on my react.js application. My coverage report seems to be working fine other than it not ignoring the files in my exclude array.
I have tried adding this to my package.json
file:
"nyc": {
"exclude": [
"AddressFormatter.js"
]
}
I have tried including the full path name src/components/AddressFormatter
as well as **/AddressFormatter.js
.
I have also tried using a .nycrc.json
with the following content:
{
"reporter": ["lcov", "text-summary"],
"sourceMap": true,
"instrument": true,
"temp-dir": "app/test/.nyc_output",
"report-dir": "app/test/coverage",
"all": true,
"exclude": ["**/AddressFormatter.js"],
"check-coverage": true
}
The steps I took to find this problem. From the terminal I ran
yarn add -D @cypress/code-coverage
Then I ran
yarn add -D nyc
Next I ran
nyc instrument ./src ./coverage
Lastly I updated the package.json
start script with
"start": "react-scripts -r @cypress/instrument-cra start"
After this I tried all of the methods above to get my coverage report to ignore different files.
So far I have had no success ignoring this file. Any suggestions would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在文档之后,您可以尝试一些选项:
exclududefterremap
选项。引用reporeadme
:Following the docs seems that there are a couple of options you can try:
excludeAfterRemap
option. Quoting the repoREADME
: