diff --git a/lib/index.js b/lib/index.js index 9f178f9..d021c14 100644 --- a/lib/index.js +++ b/lib/index.js @@ -18,7 +18,7 @@ module.exports = function (ops) { // Default ops ops = ops || {}; // Setup - var bin = ops.bin || join(require.resolve('mocha'), '..', 'bin', 'mocha' + (proc.getPlatform() === 'win32' ? '.cmd' : '')); + var bin = ops.bin || join(process.cwd(), 'node_modules', '.bin', 'mocha' + (proc.getPlatform() === 'win32' ? '.cmd' : '')); var env = _.extend(_.clone(process.env), ops.env || {}); ops = _.omit(ops, ['bin', 'env']); diff --git a/test/index.test.js b/test/index.test.js index 3adbb87..946eb03 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -39,7 +39,7 @@ describe('gulp-spawn-mocha tests', function () { }); describe('binary location', function () { - var bin = require('path').join(require.resolve('mocha'), '..', 'bin', 'mocha'); + var bin = require('path').join(process.cwd(), 'node_modules', '.bin', 'mocha'); it('should default to proper binary', function () { var stream = this.stream = mocha();