I am experiencing a weird issue where upgrading gulp-mocha from 3.0.1 to 4.0.1 causes code coverage to no longer work. The tests run as before, but istanbul is no longer able to pick things up and it reports 0% code coverage.
This affects this PR https://github.com/ek9/generator-license-cc/pull/25/files
Test coverage before update ( https://travis-ci.org/ek9/generator-license-cc/jobs/195271001 ):
21 passing (1s)
-----------|----------|----------|----------|----------|----------------|
File | % Stmts | % Branch | % Funcs | % Lines |Uncovered Lines |
-----------|----------|----------|----------|----------|----------------|
app/ | 100 | 93.1 | 100 | 100 | |
index.js | 100 | 93.1 | 100 | 100 | |
-----------|----------|----------|----------|----------|----------------|
All files | 100 | 93.1 | 100 | 100 | |
-----------|----------|----------|----------|----------|----------------|
Test coverage after update ( https://travis-ci.org/ek9/generator-license-cc/jobs/205308602 ):
21 passing (950ms)
-----------|----------|----------|----------|----------|----------------|
File | % Stmts | % Branch | % Funcs | % Lines |Uncovered Lines |
-----------|----------|----------|----------|----------|----------------|
app/ | 0 | 0 | 0 | 0 | |
index.js | 0 | 0 | 0 | 0 |... 294,295,297 |
-----------|----------|----------|----------|----------|----------------|
All files | 0 | 0 | 0 | 0 | |
-----------|----------|----------|----------|----------|----------------|
gulpfile.js
'use strict';
var path = require('path');
var gulp = require('gulp');
var eslint = require('gulp-eslint');
var excludeGitignore = require('gulp-exclude-gitignore');
var mocha = require('gulp-mocha');
var istanbul = require('gulp-istanbul');
var nsp = require('gulp-nsp');
var plumber = require('gulp-plumber');
var coveralls = require('gulp-coveralls');
// ... some parts omitted ...
gulp.task('pre-test', function () {
return gulp.src('app/*.js')
.pipe(excludeGitignore())
.pipe(istanbul({
includeUntested: true
}))
.pipe(istanbul.hookRequire());
});
gulp.task('test', ['pre-test'], function (cb) {
var mochaErr;
gulp.src('test/**/*.js')
.pipe(plumber())
.pipe(mocha({reporter: 'spec'}))
.on('error', function (err) {
mochaErr = err;
})
.pipe(istanbul.writeReports())
.on('end', function () {
cb(mochaErr);
});
});
For full source you can check the PR or repository ek9/generator-license-cc#25 (comment)
I am experiencing a weird issue where upgrading
gulp-mochafrom3.0.1to4.0.1causes code coverage to no longer work. The tests run as before, but istanbul is no longer able to pick things up and it reports 0% code coverage.This affects this PR https://github.com/ek9/generator-license-cc/pull/25/files
Test coverage before update ( https://travis-ci.org/ek9/generator-license-cc/jobs/195271001 ):
Test coverage after update ( https://travis-ci.org/ek9/generator-license-cc/jobs/205308602 ):
gulpfile.jsFor full source you can check the PR or repository ek9/generator-license-cc#25 (comment)