Skip to content

Commit 5f38808

Browse files
author
jeffmo
committed
Make bin/jest.js point directly at CWD-local "jest" bin (rather than node_modules/.bin/jest)
npm on windows doesn't use some form of symlinks like on *nix, but instead uses wrapper batch files of some kind. As such, it's unreliable to assume that node_modules/.bin/jest is a JS module. This changes bin/jest.js to, instead, try to directly require the binary path.
1 parent 44ee9a8 commit 5f38808

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

bin/jest.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -310,18 +310,19 @@ function _main() {
310310
cwdPackageRoot = path.resolve(cwdPackageRoot, '..');
311311
}
312312

313+
// Is there a package.json at our cwdPackageRoot that indicates that there
314+
// should be a version of Jest installed?
315+
var cwdPkgJsonPath = path.join(cwdPackageRoot, 'package.json');
316+
313317
// Is there a version of Jest installed at our cwdPackageRoot?
314318
var cwdJestBinPath = path.join(
315319
cwdPackageRoot,
316320
'node_modules',
317-
'.bin',
318-
'jest'
321+
'jest-cli',
322+
'bin',
323+
'jest.js'
319324
);
320325

321-
// Is there a package.json at our cwdPackageRoot that indicates that there
322-
// should be a version of Jest installed?
323-
var cwdPkgJsonPath = path.join(cwdPackageRoot, 'package.json');
324-
325326
// If a version of Jest was found installed in the CWD package, run using that
326327
if (fs.existsSync(cwdJestBinPath)) {
327328
var jestBinary = require(cwdJestBinPath);

0 commit comments

Comments
 (0)