should I replace wct-istanbul by WCT-istanbub in order to estimate how much polymer web compnents is test coveraged

522 views Asked by At

There is some similiarity between my question and How to measure common coverage for Polymer components + .js files?. Nevertheless, it is accepted as answer "split to .js files and include it to components" in order to use wct-istanbul and all my web components and tests are in .html files (the javascript is inside of each .html file).

My straight question is: can I still use wct-istambul to check how much from my code is covered by tests? If so, what is wrong in configuration described bellow? If not, is wct-istanbub planned to replace wct-istanbul for polymer projects?

package.json

"polyserve": "^0.18.0",
"web-component-tester": "^6.0.0",
"web-component-tester-istanbul": "^0.10.0",

...

wct.conf.js

var path = require('path');

var ret = {
    'suites': ['test'],
    'webserver': {
        'pathMappings': []
    },
    'plugins': {
        'local': {
            'browsers': ['chrome']
        },
        'sauce': {
            'disabled': true
        },
        "istanbul": {
            "dir": "./coverage",
            "reporters": ["text-summary", "lcov"],
            "include": [
                "/*.html"
            ],
            "exclude": [
            ],
            thresholds: {
              global: {
                statements: 100
              }
            }
        }
    }
};

var mapping = {};
var rootPath = (__dirname).split(path.sep).slice(-1)[0];

mapping['/components/' + rootPath + '/bower_components'] = 'bower_components';

ret.webserver.pathMappings.push(mapping);

module.exports = ret;

enter image description here

Well, I tried WCT-istanbub (https://github.com/Bubbit/wct-istanbub) which seams to be a temporary workaround (Code coverage of Polymer Application with WCT), it works.

wct.conf.js

        "istanbub": {
            "dir": "./coverage",
            "reporters": ["text-summary", "lcov"],
            "include": [
                "**/*.html"
            ],
            "exclude": [
              "**/test/**",
              "*/*.js"
            ],
            thresholds: {
              global: {
                statements: 100
              }
            }
        }
...

and the result is ... chrome 66 RESPONSE quit() chrome 66 BrowserRunner complete Test run ended with great success

chrome 66 (2/0/0)

=============================== Coverage summary ===============================
Statements   : 21.18% ( 2011/9495 )
Branches     : 15.15% ( 933/6160 )
Functions    : 18.08% ( 367/2030 )
Lines        : 21.14% ( 2001/9464 )
================================================================================
Coverage for statements (21.18%) does not meet configured threshold (100%)




Error: Coverage failed
0

There are 0 answers