Skip to content

Commit af864c1

Browse files
authored
fix: account for difference in behavior between npm v6 and v7 (#223) (#225)
1 parent 70853d6 commit af864c1

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/utils/test-runner.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,14 @@ function getJestPath() {
3232
const packageJsonPath = require.resolve('jest/package.json');
3333

3434
const { bin } = require(packageJsonPath);
35-
return path.resolve(path.dirname(packageJsonPath), bin);
35+
36+
// Account for difference in behavior between npm v6 and v7 (#221)
37+
let normalizedBinPath = bin;
38+
if (typeof bin === 'object') {
39+
normalizedBinPath = bin.jest;
40+
}
41+
42+
return path.resolve(path.dirname(packageJsonPath), normalizedBinPath);
3643
}
3744

3845
function getJestArgs(argv) {

0 commit comments

Comments
 (0)