Skip to content

Commit 2c906c7

Browse files
authored
fix: retrieve right binary path (#195)
1 parent d4be41b commit 2c906c7

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/config.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,11 @@ const jestConfig = {
3737

3838
const expectedApiVersion = '50.0';
3939

40-
// Execute command is different on Windows.
41-
const jestPath =
42-
process.platform == 'win32' ? './node_modules/jest/bin/jest.js' : 'node_modules/.bin/jest';
40+
const jestPath = (() => {
41+
const packageJsonPath = require.resolve('jest/package.json');
42+
const { bin } = require(packageJsonPath);
43+
44+
return path.resolve(path.dirname(packageJsonPath), bin);
45+
})();
4346

4447
module.exports = { jestConfig, jestPath, expectedApiVersion };

0 commit comments

Comments
 (0)