gotwarlost / istanbul

Yet another JS code coverage tool that computes statement, line, function and branch coverage with module loader hooks to transparently add coverage when running tests. Supports all JS coverage use cases including unit tests, server side functional tests and browser tests. Built for scale.
Other
8.7k stars 786 forks source link

Jenkins hanging after adding istanbul jsxcoverage to my code #676

Open lohith-s opened 8 years ago

lohith-s commented 8 years ago

I have added this in gulpfile.babel.js for test case coverage reports to be generated.

const jsxCoverageOpts = { src: opts.componentTestFiles || [], isparta: true, istanbul: { preserveComments: true, coverageVariable: 'MY_TEST_COVERAGE', exclude: /node_modules|test|icons|lib|index/, include: /.js?$/ }, transpile: { babel: { include: /.js?$/, exclude: /node_modules/ } },
coverage: { reporters: ['text', 'json','lcov'], directory: 'coverage' } };

gulp.task('mocha', function () { jsxCoverage.initModuleLoaderHack(jsxCoverageOpts);
return gulp.src(opts.componentTestFiles) .pipe(babel()) .pipe(mocha({timeout: 10000, require: ['./test/js/components/0_setup.js']})) .once('end', jsxCoverage.collectIstanbulCoverage(jsxCoverageOpts)) .once('error', function(err) { if (err !== undefined && err.message !== undefined && err.message.indexOf("failed") > -1) { console.log("Error :: " + err.message); process.exit(1); } else { console.log('End :: Test coverage report available at coverage/lcov-report/index.html'); this.emit('end'); } }); });

Locally with npm install build is fine and am able to see reports in coverage directory as well, but in jenkins it fails...