From 2c906c7f77342e74fbe93fbad1983bcf8a6728d9 Mon Sep 17 00:00:00 2001 From: Pierre-Marie Dartus Date: Thu, 28 Jan 2021 17:40:13 +0100 Subject: [PATCH] fix: retrieve right binary path (#195) --- src/config.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/config.js b/src/config.js index 34513a70..2dd1aa77 100644 --- a/src/config.js +++ b/src/config.js @@ -37,8 +37,11 @@ const jestConfig = { const expectedApiVersion = '50.0'; -// Execute command is different on Windows. -const jestPath = - process.platform == 'win32' ? './node_modules/jest/bin/jest.js' : 'node_modules/.bin/jest'; +const jestPath = (() => { + const packageJsonPath = require.resolve('jest/package.json'); + const { bin } = require(packageJsonPath); + + return path.resolve(path.dirname(packageJsonPath), bin); +})(); module.exports = { jestConfig, jestPath, expectedApiVersion };