jeudi 4 février 2016

How to exclude individual files from istanbul coverage

I have my istanbul configured successfully working with mocha. Recently we are trying to exclude some 3 js files from the coverage due to some technical issue. Below i show i configure my .istanbul file.

verbose: false
instrumentation:
    extensions:
      - .js
    root: ./src
    default-excludes: true
    excludes: ['**/__tests__/**' ,'src/electron.js','src/_store/myfile1.js','src/_store/myfile2.js','src/_store/myfile3.js']
    embed-source: false
    variable: __coverage__
    compact: true
    preserve-comments: false
    complete-copy: false
    save-baseline: false
    baseline-file: ./coverage/coverage-baseline.json
reporting:
    print: summary
    reports:
        - lcov
    dir: ./coverage
    watermarks:
        statements: [50, 80]
        lines: [50, 80]
        functions: [50, 80]
        branches: [50, 80]
hooks:
    hook-run-in-context: false
    post-require-hook: null

In the package.json, we have our coverage configured as

 "test:coverage": "./node_modules/.bin/babel-istanbul --include-all-sources cover ./node_modules/.bin/_mocha ./src/**/*.js",

After running my test, the coverage works fine and the report generated . However, the 3 files are not excluded as we intended. Please how do i exclude them ? I understand how to exclude folder and did that successfully. But individual files just aren't working. Any help would be appreciated.

Aucun commentaire:

Enregistrer un commentaire