Skip to content

Commit

Permalink
Prevent babelrc package import failure on relative current path (jest…
Browse files Browse the repository at this point in the history
  • Loading branch information
kwonoj authored and cpojer committed Jun 6, 2017
1 parent 36706aa commit 95aacbe
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/babel-jest/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ const createTransformer = (options: any) => {
cache[directory] = JSON.stringify(require(configJsFilePath));
break;
}
const packageJsonFilePath = path.join(directory, PACKAGE_JSON);
const resolvedJsonFilePath = path.join(directory, PACKAGE_JSON);
const packageJsonFilePath = resolvedJsonFilePath === PACKAGE_JSON
? path.resolve(directory, PACKAGE_JSON)
: resolvedJsonFilePath;
if (fs.existsSync(packageJsonFilePath)) {
// $FlowFixMe
const packageJsonFileContents = require(packageJsonFilePath);
Expand Down

0 comments on commit 95aacbe

Please sign in to comment.