I have an istanbul coverage that i use in my package.json like below.
"test:coverage": "./node_modules/.bin/babel-istanbul --include-all-sources cover ./node_modules/.bin/_mocha ./src/**/__tests__/*.js",
And i jave an .istanbul.yml script like below. 
verbose: true
instrumentation:
    extension: .js
    root: ./src
    default-excludes: true
    excludes: ['./src/**/__tests__/**', './src/electron.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
I am trying to exclude the tests folder and the electron.js files from the coverage. However , the file and the folder are not excluding. Please where do i go wrong and how can i fix this ? Any help would be appreciated. 
Incase if some one is still having this issue. Below is how i solved mine by modifying
instrumentation:
  root: src
  include-all-sources: true
  verbose: true
  excludes: ["**/__tests__/**" ,"./electron.js"]
reporting:
  dir: "coverage"
                        What worked for us was adding the exclude syntax in our babel config:
plugins: [
    [
      'istanbul',
      {
        exclude: ['**/example/**/**/*'],
      },
    ],
  ],
We clearly hand't read thoroughly the docs! https://github.com/istanbuljs/babel-plugin-istanbul#ignoring-files
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With