istanbuljs / sample-mocha-compilers

Sample project to demo istanbul coverage with mocha using the babel compiler
7 stars 5 forks source link

Example to reproduce issue2 with istanbul-api #1

Open lo1tuma opened 8 years ago

lo1tuma commented 8 years ago

This change executes the check-coverage command in order to reproduce https://github.com/istanbuljs/istanbul-api/issues/2.

After running npm test you can see the the result from check-coverage differs from the coverage summary:

$ npm test

> sample-mocha-compilers@1.0.0 test /Users/foo/workspace/sample-mocha-compilers
> istanbul cover _mocha -- --compilers js:babel-core/register test/

  rectangle
    ✓ calculates area

  1 passing (404ms)

=============================== Coverage summary ===============================
Statements   : 83.33% ( 10/12 )
Branches     : 50% ( 2/4 )
Functions    : 100% ( 1/1 )
Lines        : 83.33% ( 10/12 )
================================================================================

> sample-mocha-compilers@1.0.0 posttest /Users/foo/workspace/sample-mocha-compilers
> istanbul check-coverage

/Users/foo/workspace/sample-mocha-compilers/node_modules/istanbul/lib/cli.js:38
        throw ex; // turn it into an uncaught exception
        ^
ERROR: Coverage for statements (84.38%) does not meet global threshold (100%)
ERROR: Coverage for branches (57.14%) does not meet global threshold (100%)
ERROR: Coverage for lines (88.89%) does not meet global threshold (100%)
npm ERR! Test failed.  See above for more details.