From 73a596af742276b2e24bad702d7d82094b12c9d6 Mon Sep 17 00:00:00 2001 From: blah238 Date: Tue, 16 Sep 2014 18:50:54 -0500 Subject: [PATCH 1/3] Fix mocha.cmd binary lookup This line of code was looking for `mocha.cmd` in Mocha's own `bin` folder. This is incorrect; there is no `mocha.cmd` file there. The `mocha.cmd` file is in the `node_modules/.bin` folder. Tested on Windows. Not sure about *nix. There is probably a better way to get to the `node_modules/.bin` folder than this, but it "works for me (tm)". --- lib/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/index.js b/lib/index.js index 9f178f9..20a7c32 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(__dirname, '..', '..', '.bin', 'mocha' + (proc.getPlatform() === 'win32' ? '.cmd' : '')); var env = _.extend(_.clone(process.env), ops.env || {}); ops = _.omit(ops, ['bin', 'env']); From 4857377209cc9a535a239a9dc082f5b4777e68eb Mon Sep 17 00:00:00 2001 From: blah238 Date: Tue, 16 Sep 2014 19:08:44 -0500 Subject: [PATCH 2/3] Trying this again --- lib/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/index.js b/lib/index.js index 20a7c32..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(__dirname, '..', '..', '.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']); From 5155b14bcd2f25a40a94ca39d4c3682f2c0479ff Mon Sep 17 00:00:00 2001 From: blah238 Date: Tue, 16 Sep 2014 19:14:15 -0500 Subject: [PATCH 3/3] Update test --- test/index.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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();