How to measure common coverage for Polymer components + .js files?

后端 未结 3 1059
你的背包
你的背包 2021-02-10 10:36

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 i

3条回答
  •  既然无缘
    2021-02-10 10:55

    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:

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

提交回复
热议问题