If we can wrangle istanbul into instrumenting html sources, we should consider making it a default.
Also see https://www.npmjs.org/package/web-component-tester-istanbul
Is there any update on making coverage part of this. The istanbul only instruments js files as of now.
Guys, this issue is ancient... Are there any plans for coverage support? It would be very useful
:+1: for coverage included by default. Could never get the wct-istanbul plugin to work right.
Is there anything I can do to help unstick this? Any blockers? Seems like a crucial feature. The instanbul plugin out there does not work, at least with the past couple major versions of wct.
There is a web-component-tester-istanbul project that has a plugin that seems to work a little bit for me - I can specify both js and html files for covering. My main issue is that even though I've specified in my .istanbul.yml file to include all sources, I think it's only including all sources pulled in by the web-component-tester.
If using straight mocha, or some other testing framework, istanbul should allow you to include all sources so you can see which files are missing testing. I'm not sure if this is something that needs covered in wct or in the wct-istanbul plugin.
/sub
The latest version of istanbul project does coverage for both js & html files. However @tucamsam is correct. This only pulls in whatever is included in the web-component-tester. I would think, this should go into the web-component-tester-istanbul project.
could someone lead me on how to run istanbul? I have installed it with npm --save-deb and I see my node_modules directory but I am unable to lunch it with wct.
is the command: wct --plugin istanbul ?
See the web-component-tester-istanbul project. As far as I could tell, Istanbul doesn't "just work" with wct.
I was able to successfully get wct and web-component-tester-istanbul to run my tests and report code coverage, which is great. Here is a how to for those who are interested in trying it out.
Code coverage for custom elements with WCT and Istanbul.
Install web-component-tester-istanbul and or dependencies
$ npm i -D web-component-tester istanbul https://github.com/t2ym/web-component-tester-istanbul/tarball/0.10.1
Update wct.conf.json
{
"suites": ["some-spec.html"],
"verbose": true,
"plugins": {
"istanbul": {
"dir": "./coverage",
"reporters": ["text-summary", "lcov"],
"include": [
"/some-element.html"
],
"exclude": []
}
}
}
Run your tests
$ wct
View your coverage
$ open ./coverage/lcov-report/index.html
Still think the polymer team can do this by default and also give coverage when you run your tests in the browser directly. Yes the above will work but they got this far to make everything else work in just a simple html file it would be silly if they could not include istanbul as well.
Any update on including coverage with wct? The web-component-tester-instanbul plugin recommended above is no longer working correctly because of this issue
/cc @admwx7
@jonniespratley not work for me. "Could not find WCT plugin named "suites""
could you give more info?
@nevir I do understand that the Polymer team has a huge amount of tasks in its Todo list, but this issue is since 2014 and no solution yet, is there a solution planned?
Below plugin is working fine to give correct test coverage in my project.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Most helpful comment
@nevir I do understand that the Polymer team has a huge amount of tasks in its Todo list, but this issue is since 2014 and no solution yet, is there a solution planned?