Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

var xml = require('xml');
var Base = require('mocha').reporters.Base;
var Spec = require('mocha').reporters.Spec;
var fs = require('fs');
var path = require('path');
var inherits = require('util').inherits;
var debug = require('debug')('mocha-junit-reporter');
var mkdirp = require('mkdirp');
var md5 = require('md5');
Expand Down Expand Up @@ -217,8 +219,13 @@ function MochaJUnitReporter(runner, options) {
return testsuites[testsuites.length - 1].testsuite;
}

// get functionality from the Base reporter
Base.call(this, runner);
if (this._options.spec) {
// get functionality from the Spec reporter
Spec.call(this, runner);
} else {
// get functionality from the Base reporter
Base.call(this, runner);
}

// remove old results
this._runner.on('start', function() {
Expand Down Expand Up @@ -276,6 +283,8 @@ function MochaJUnitReporter(runner, options) {
}.bind(this));
}

inherits(MochaJUnitReporter, Base);

/**
* Produces an xml node for a test suite
* @param {Object} suite - a test suite
Expand Down