Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to measure common coverage for Polymer components + .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.

like image 387
Julia Savinkova Avatar asked Oct 29 '22 13:10

Julia Savinkova


1 Answers

For Polymer, you would normally use web-component-tester (WCT) to test your components, and the web-component-tester-istanbul plugin for code coverage. You'd configure wct.conf.json in the root of your project with something 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 outputs something like this:

enter image description here

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).

like image 116
tony19 Avatar answered Nov 12 '22 15:11

tony19