How to measure overall coverage for Polymer + .js components?

How to measure the total coverage for polymer components with all .js files in a solution (QUnit is used for non-component tests)?

I tried karma-coverage , but it only works for .js files.

+6
source share
3 answers

For polymer components, there is a solution for measuring overall coverage using karma-coverage : splitting into .js files and including it in components. Example here

+1
source

For Polymer, you usually use web-component-tester (WCT) to test your components, and the web-component-tester-istanbul plugin to cover the code. You configured wct.conf.json in the root of your project like this:

 { "suites": [ "test/components/my-view1/my-view1.html" ], "plugins": { "istanbul": { "dir": "./build/coverage", "reporters": [ "text-summary", "lcov" ], "include": [ "*.js", "*.html" ], "exclude": [] } } } 

And then run wct , which will output something like this:

enter image description here

Unfortunately, a recent WCT update made the coverage plugin incompatible , so the plugin is never called, so coverage is always displayed as 100% (0/0) (no lines are visible, no lines are visible).

+2
source

@ tony19, this PR commits the web-component-tester-istanbul plugin to support WCT> = 6.4.0 https://github.com/thedeeno/web-component-tester-istanbul/pull/45

0
source

Source: https://habr.com/ru/post/1014184/


All Articles