伊斯坦堡纽约市排除测试文件 [英] Istanbul nyc to exclude test files

查看:89
本文介绍了伊斯坦堡纽约市排除测试文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在最终测试中获得我的测试文件.这可能是因为它们位于我的组件旁边,而不是拥有自己的 test 文件夹. 如何将这些排除在保险范围之外?

I'm currently getting my test files in the final coverage. That's probably because they sit alongside my components instead of having their own test folder. How can I exclude these from the coverage?

我已经安装了 istanbul nyc ,并且正在使用 mocha .

I have installed istanbul and nyc and I'm using mocha.

我的脚本如下:

"test": "nyc --reporter=html mocha tools/testSetup.js app/**/*.spec.js || true"

推荐答案

对,经过一些挖掘,我设法使它起作用.我添加了

Right, after some digging I've managed to get this working. I've added

"nyc": { "include": "app", - only looks in the app folder "exclude": "**/*.spec.js" }

"nyc": { "include": "app", - only looks in the app folder "exclude": "**/*.spec.js" }

到我的package.json.由于使用的是 webpack ,我可能会尝试在 webpack.config 文件中找到一种定义此规则的方法(如果可能的话).如果得到答案,我会回来.

to my package.json. Since I'm using webpack I'll probably try and find a way of defining this rule in the webpack.config file (if possible at all). I'll come back if I get an answer to this.

这篇关于伊斯坦堡纽约市排除测试文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆