本文介绍了使用Ember-cli-blanket进行覆盖时,数据包含Ember本身的文件,而不是我创建的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在项目中添加了ember-cli-blanket,并设法使其正常运行。 localhost:4200 / tests?coverage将显示覆盖率数据。但是,结果中包含 project / components / modal-dialog或 project / components / modal-dialog-overlay之类的文件,这些文件不是项目中的文件,但由于项目使用模态,因此被Ember包含对话框中的一个模板文件。这些额外的测试文件不会给我带来任何新的东西,因为我没有测试余烬代码库,而是通过将我的测试与其他测试混在一起实际上弄乱了结果。该项目仍然很小,需要测试约11个实际文件,因此我必须将大约12个文件添加到毯子option.js中的loaderExclusions中。可以通过排除来消除某些错误,例如:

I added ember-cli-blanket into my project and managed to get it working fine. localhost:4200/tests?coverage would show the coverage data. However it included files such as 'project/components/modal-dialog' or 'project/components/modal-dialog-overlay' in the results, which are not files in the project, but are included by Ember since the project uses a modal dialog in one of the template files. These extra test files don't give me anything new since I'm not testing the ember codebase and actually muddle the results by mixing in my tests with other ones. The project is still small, and with ~11 actual files needing testing, there were around 12 files I had to add to the loaderExclusions in blanket-options.js. Some could be gotten rid of with an exclusion like:

loaderExclusions: ['project/initializers'],

但是对于项目/组件下的组件,我确实想测试项目中的组件,因此分别排除每个人。而且,如果我最终在其中要测试的文件中有任何文件,则不能保证排除所有初始化程序文件不会再咬我。考虑到到目前为止该项目有多小,而且排除项目比实际文件更多,这似乎不是一个可持续的解决方案。

But for the ones under project/components, I do want to test the components that are part of the project, so I had to exclude each one individually. And there's no guarantee that excluding all initializers files won't come back to bite me if I actually end up with any files in there I want to test. Considering how small the project is so far, and the fact that there are more exclusions than actual files, this doesn't seem like a sustainable solution.

我在做什么我的设置有误吗?这是我可以使用默认值为以下值的过滤器解决的吗?

Am I doing something wrong in my set-up? Is this something I can solve with my filter which is currently on a default of:

filter: '/.*project/.*/',

任何帮助将不胜感激。

作为旁注,我一直在研究与伊斯坦布尔以及Karma作为Ember中覆盖率数据的其他选项的证词,但一直无法找到它们。如果您对设置的建议还可以。

As a sidenote, I've been looking into testem with Istanbul as well as Karma as other options for coverage data in Ember but have been unable to get anywhere with them. If you have suggestions on the setup for those that would also be fine.

推荐答案

我正在使用 ember -cli-blanket 然后找到 ember-cli-code-coverage 。在撰写本文时,位于 9f1dd33f sandersky 分支对我解决您的问题类型非常有用重新描述。

I was using ember-cli-blanket then found ember-cli-code-coverage. As of this writing, the sandersky fork, at 9f1dd33f, works great for me to solve the type of problem you're describing.

它不使用毯子而是使用伊斯坦布尔。

It solves it not using blanket, but using istanbul.

这篇关于使用Ember-cli-blanket进行覆盖时,数据包含Ember本身的文件,而不是我创建的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-01 19:43