When using Ember-cli-blanket for coverage data inc

2019-09-10 03:18发布

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/.*/',

Any help would be appreciated.

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.

2条回答
太酷不给撩
2楼-- · 2019-09-10 03:54

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.

https://github.com/kategengler/ember-cli-code-coverage/pull/11

It solves it not using blanket, but using istanbul.

查看更多
霸刀☆藐视天下
3楼-- · 2019-09-10 04:09

It doesn't look like there's anything wrong with your setup. What you're seeing is apparently due to how blanket.js works. See this issue for more information: https://github.com/sglanzer/ember-cli-blanket/issues/17

查看更多
登录 后发表回答