Skip to content

Commit 1d9a116

Browse files
authored
Merge pull request #57 from dead-horse/fix-lookup-bin
fix: ensure find framework bin path
2 parents 79b7efa + 8efdf97 commit 1d9a116

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

lib/run/index.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ Runner.prototype.initFramework = function() {
7272
args.unshift('--colors');
7373
}
7474

75-
var testProcess = childProcess.spawn(frameworkBin, args, {
75+
args.unshift(frameworkBin);
76+
77+
var testProcess = childProcess.spawn(process.execPath, args, {
7678
cwd: path.resolve(this.options.cwd || defaultOpt.cwd),
7779
env: _.merge({}, process.env, this.options.env || {})
7880
});
@@ -111,12 +113,9 @@ module.exports = function(options) {
111113
function lookupFramework(framework, filepath) {
112114
try {
113115
let frameworkBin = require.resolve(path.join(filepath, framework));
114-
let lastIndexOf = frameworkBin.lastIndexOf('node_modules');
115-
if (lastIndexOf > 0) {
116-
frameworkBin = path.join(frameworkBin.slice(0, lastIndexOf), 'node_modules', '.bin', framework);
117-
}
116+
frameworkBin = path.join(path.dirname(frameworkBin), 'bin', framework);
118117
// ensure framework exists.
119118
fs.accessSync(frameworkBin);
120119
return frameworkBin;
121120
} catch (e) {}
122-
}
121+
}

0 commit comments

Comments
 (0)