diff --git a/index.js b/index.js index d19e8bb..101d19a 100644 --- a/index.js +++ b/index.js @@ -3,6 +3,8 @@ const dargs = require('dargs'); const execa = require('execa'); const gutil = require('gulp-util'); const through = require('through2'); +// TODO: Use execa localDir option when available +const npmRunPath = require('npm-run-path'); module.exports = opts => { opts = Object.assign({ @@ -38,7 +40,9 @@ module.exports = opts => { } function flush(done) { - let proc = execa('mocha', files.concat(args)); + const env = npmRunPath.env({cwd: __dirname}); + const proc = execa('mocha', files.concat(args), {env}); + proc.then(result => { this.emit('_result', result); done(); diff --git a/package.json b/package.json index 2cf2b54..ada6bf7 100644 --- a/package.json +++ b/package.json @@ -37,6 +37,7 @@ "execa": "^0.6.0", "gulp-util": "^3.0.0", "mocha": "^3.0.0", + "npm-run-path": "^2.0.2", "through2": "^2.0.3" }, "devDependencies": {