diff --git a/lib/reporters/xunit.js b/lib/reporters/xunit.js index d9f58b9f05..7c16302c63 100644 --- a/lib/reporters/xunit.js +++ b/lib/reporters/xunit.js @@ -7,6 +7,8 @@ var utils = require('../utils'); var inherits = utils.inherits; var fs = require('fs'); var escape = utils.escape; +var mkdirp = require('mkdirp'); +var path = require('path'); /** * Save timer references to avoid Sinon interfering (see GH-237). @@ -43,6 +45,7 @@ function XUnit(runner, options) { if (!fs.createWriteStream) { throw new Error('file output not supported in browser'); } + mkdirp.sync(path.dirname(options.reporterOptions.output)); self.fileStream = fs.createWriteStream(options.reporterOptions.output); }