lundi 1 février 2016

Include non test files coverage -- Istanbul

Please i have an istanbul coverage on my mocha test . Its working fine and my coverage is run like below.

"test:coverage": "./node_modules/.bin/babel-istanbul cover ./node_modules/.bin/_mocha ./src/**/__tests__/*.js"

from my package.json. However, my after generating the report ,i learn that only the js files inside my ./src/**/__tests__/*.js which i explicitly specified are tested . This however is what i want. But i wanted my coverage report to include the js files that i jave not tested . Example for every myFile.js i have myFile-test.js at the moment. I want a report to include like tested files inside the tests fiolder as i intended . And untested files that are not inside the __tests folder. That way i would be able to compare which file i have written a test for and not . I thought adding .istanbul.yml would address that and i did below.

verbose: false
instrumentation:
    root: .
    default-excludes: false
    excludes: ['./node_modules/**','./src/electron.js','./build/**']
    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
hooks:
    hook-run-in-context: false
    post-require-hook: null

Yet my test is returning the errors 'ouldn't find preset "airbnb" relative to directory ".../node_modules/enzyme"] Transformation error; return original code . I repsumed my node_modules are not excluding also . Please how do i address this ? Any help would be appreciated .

Aucun commentaire:

Enregistrer un commentaire