Skip to content

Commit

Permalink
Merge pull request #42 from adamgruber/feature/dirs
Browse files Browse the repository at this point in the history
Better support for custom dirs
  • Loading branch information
adamgruber committed Apr 10, 2016
2 parents 6e26b8a + 0b1397c commit aaeb0ec
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 9 deletions.
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
language: node_js
node_js:
- "0.10"
- "0.10"
- "0.12"
- "4"
- "5"
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#Changelog

###1.3.3
- Added support for creating custom dir where the parent dir(s) may not exist yet. See [#40](https://github.com/adamgruber/mochawesome/issues/40)

###1.3.2
- Removed `allHooks` array since it was not being used and could lead to an issue where node runs out of memory while rendering the template. See [#33](https://github.com/adamgruber/mochawesome/issues/33)

Expand Down
12 changes: 9 additions & 3 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ var gulp = require('gulp'),
wrap = require('gulp-wrap'),
declare = require('gulp-declare'),
watch = require('gulp-watch'),
mocha = require('gulp-spawn-mocha'),
mocha = require('gulp-mocha'),
spawnmocha = require('gulp-spawn-mocha'),
config = require('./lib/config')();

var mochaOpts = {
Expand Down Expand Up @@ -157,7 +158,7 @@ gulp.task('watch', function () {
// Test Tasks
gulp.task('fiveby', function () {
return gulp.src(testPaths.fiveby)
.pipe(mocha(mochaOpts))
.pipe(spawnmocha(mochaOpts))
.on('error', console.warn.bind(console));
});

Expand All @@ -181,7 +182,12 @@ gulp.task('test-recursive', function () {
});

gulp.task('testOpts', function () {
mochaOpts.reporterOptions = 'reportDir=customDir,reportName=customName,reportTitle=customTitle,inlineAssets=true';
mochaOpts.reporterOptions = {
reportDir: 'customDir',
reportName: 'customName',
reportTitle: 'customTitle',
inlineAssets: true
};
return gulp.src(testPaths.basic)
.pipe(mocha(mochaOpts))
.on('error', console.warn.bind(console));
Expand Down
7 changes: 3 additions & 4 deletions lib/reportGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ var async = require('async'),
fs = require('fs'),
ncp = require('ncp'),
_ = require('lodash'),
chalk = require('chalk');
chalk = require('chalk'),
mkdirp = require('mkdirp');

exports.generateReport = generateReport;
exports.saveToFile = saveToFile;
Expand Down Expand Up @@ -47,9 +48,7 @@ function createDirs (config, inline, callback) {
dirs = dirs.concat([config.reportJsDir, config.reportFontsDir, config.reportCssDir]);
}
dirs.forEach(function(dir) {
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir);
}
mkdirp.sync(dir);
});
callback(null, 'done');
}
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mochawesome",
"version": "1.3.2",
"version": "1.3.3",
"description": "A Gorgeous HTML/CSS Reporter for Mocha.js",
"scripts": {
"test": "gulp build"
Expand All @@ -26,6 +26,7 @@
"highlight.js": "^8.5.0",
"json-stringify-safe": "^5.0.0",
"lodash": "^3.1.0",
"mkdirp": "^0.5.1",
"mocha": "*",
"moment": "^2.9.0",
"ncp": "^1.0.1",
Expand All @@ -41,6 +42,7 @@
"gulp-handlebars": "^4.0.0",
"gulp-jshint": "^1.9.0",
"gulp-less": "^3.0.3",
"gulp-mocha": "^2.2.0",
"gulp-plumber": "^0.6.6",
"gulp-spawn-mocha": "^0.5.2",
"gulp-uglify": "^1.1.0",
Expand Down

0 comments on commit aaeb0ec

Please sign in to comment.