diff --git a/lib/launcher.ts b/lib/launcher.ts index 6a92e20ea..51dc5b53c 100644 --- a/lib/launcher.ts +++ b/lib/launcher.ts @@ -3,6 +3,8 @@ * input configuration and launching test runners. */ import * as fs from 'fs'; +let {mkdirp} = require('mkdirp'); +import * as path from 'path'; import * as q from 'q'; import {Config} from './config'; @@ -43,6 +45,10 @@ class TaskResults { } saveResults(filepath: string): void { + let dirname = path.dirname(filepath); + if (!fs.existsSync(dirname)) { + mkdirp.sync(dirname); + } let jsonOutput = this.results_.reduce((jsonOutput, result) => { return jsonOutput.concat(result.specResults); }, []); diff --git a/package.json b/package.json index b3a13bdd0..7f23cf50a 100644 --- a/package.json +++ b/package.json @@ -48,6 +48,7 @@ "jshint": "^2.9.2", "lodash": "^4.5.1", "marked": "^0.3.3", + "mkdirp": "^0.5.1", "mocha": "2.5.3", "rimraf": "~2.5.3", "run-sequence": "^1.1.5",