a failing assertion will not produce a coverage report
Opened this issue · 0 comments
Deleted user commented
Reference: failing assertion prevents coverage tool from running
(passing assertions will produce coverage with the right command switches)
Any help with this issue would be appreciated.
setup
./src/test.js
const zero = () => 0;
export { zero };
./test/test.spec.js
const assert = require('assert');
import { zero } from '../src/test';
describe('assert false', () => {
it('should not crash isparta', done => {
const result = zero();
try {
assert.strictEqual(result, 1);
done();
} catch (error) {
done(error);
}
});
});
package.json
{
"name": "test",
"devDependencies": {
"babel-core": ">=6.1.21",
"babel-preset-es2015": ">=6.1.18",
"isparta": ">=4.0.0",
"mocha": ">=2.3.4"
}
}
results
failing
$ ./node_modules/isparta/bin/isparta cover --root ./src ./node_modules/mocha/bin/_mocha -- ./test/test.spec.js --require babel-core/register
assert false
1) should not crash isparta
0 passing (40ms)
1 failing
1) assert false should not crash isparta:
AssertionError: 0 === 1
+ expected - actual
-0
+1
at Context.<anonymous> (test.spec.js:10:14)
failing with --include-all-sources
$ ./node_modules/isparta/bin/isparta cover --root ./src --include-all-sources ./node_modules/mocha/bin/_mocha -- ./test/test.spec.js --require babel-core/register
assert false
1) should not crash isparta
0 passing (29ms)
1 failing
1) assert false should not crash isparta:
AssertionError: 0 === 1
+ expected - actual
-0
+1
at Context.<anonymous> (test.spec.js:10:14)
passing
$ ./node_modules/isparta/bin/isparta cover --root ./src ./node_modules/mocha/bin/_mocha -- ./test/test.spec.js --require babel-core/register
assert false
✓ should not crash isparta
1 passing (35ms)
No coverage information was collected, exit without writing coverage information
passing with --include-all-sources
$ ./node_modules/isparta/bin/isparta cover --root ./src --include-all-sources ./node_modules/mocha/bin/_mocha -- ./test/test.spec.js --require babel-core/register
assert false
✓ should not crash isparta
1 passing (20ms)
================================================================================
Writing coverage object [./coverage/coverage.json]
Writing coverage reports at [./coverage]
================================================================================
=============================== Coverage summary ===============================
Statements : 100% ( 4/4 )
Branches : 100% ( 0/0 )
Functions : 100% ( 1/1 )
Lines : 100% ( 2/2 )
================================================================================