Support test artifacts from istanbul/mocha for node.js projects



This was a problem for me, but @drazisil pointed me at and that solved all my problems. THANKS!


I have this working with gulp and

Relevant parts:


    version: v0.11.13
    CIRCLE_ARTIFACTS: "~/node-p2pool/coverage"
    - "coverage" # relative to the user's home directory


gulp.task('test', ['pre-test'], function (cb) {
  return gulp.src(['./test/**/*.js'])
  .pipe(mocha({ reporter: 'spec' }))
  .pipe(istanbul.writeReports()) // stores reports in "coverage" directory

I actually switched to Circle from Travis due to an ad on coveralls, so then I had to figure this out. Hope it helps! :smiley:


Well, I have managed to grab all the coverage reports and put them in the artifacts location, but CircleCI is not able to tell me test pass/fail #s. Does your solution do that?



For the above code my artifacts tab looks like this:

The index.html is here:


I’m looking at your run:

CircleCI doesn’t know how many tests your code ran. I have a java project using junit and on the Test Results tab, it says “Your build ran 9 tests in junit with 0 failures.” My feature request is to do the same thing for node.js projects using istanbul.


I’ve added to get the junit output.

The output is

The files are at

Affected files:

  • Gulpfile.js
  • circle.js


mocha-junit-reporter is just what I needed! Many thanks! Is it possible to resolve my Feature Request as not needed?


I think probably by choosing the fixed/solution link next to the post that fixed it. Happy to help! :smiley:


As a final post, for those who are interested, I adjusted the instructions so CircleCi now sees and reports the junit results in the test metadata tab


  • Gulp
  • Mocha
  • mocha-junit-reporter
  • gulp-mocha
  • gulp-istanbul

circle.yml section:

    - "coverage" # relative to the user's home directory

Gulp Tasks:

gulp.task('pre-test', function () {
  return gulp.src(['lib/**/*.js'])
    // Covering files
    // Force `require` to return covered files

gulp.task('test', ['pre-test'], function (cb) {
  return gulp.src([
    reporter: 'mocha-junit-reporter',
    reporterOptions: {
        mochaFile: process.env.CIRCLE_TEST_REPORTS + '/junit/results.xml'
  .pipe(istanbul.writeReports()) // stores reports in "coverage" directory