How to measure common coverage for Polymer components with all .js
files in solution (for non-component tests QUnit is used)?
I tried karma-coverage, but it works only for .js
files.
How to measure common coverage for Polymer components with all .js
files in solution (for non-component tests QUnit is used)?
I tried karma-coverage, but it works only for .js
files.
For Polymer components there is a solution to measure common coverage with
karma-coverage
: split to .js files and include it to components. Example is here@tony19, this PR fixes the web-component-tester-istanbul plugin to support WCT >= 6.4.0 https://github.com/thedeeno/web-component-tester-istanbul/pull/45
For Polymer, you would normally use
web-component-tester
(WCT) to test your components, and theweb-component-tester-istanbul
plugin for code coverage. You'd configurewct.conf.json
in the root of your project with something like this:And then run
wct
, which outputs something like this:Unfortunately, a recent upgrade in WCT has made the coverage plugin incompatible, such that the plugin never gets called, so coverage is always shown as
100% (0/0)
(no lines covered, no lines seen).