Skip to content

Commit

Permalink
alternate fix
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Sep 4, 2019
1 parent 7bf052d commit d9aaa1e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/jest-resolve/src/defaultResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ function resolveSync(

if (REGEX_RELATIVE_IMPORT.test(target)) {
// resolve relative import
const resolveTarget = path.resolve(basedir, target);
let resolveTarget = path.resolve(basedir, target);
if (target === '..' || target.endsWith('/')) {
resolveTarget += '/';
}
const result = tryResolve(resolveTarget);
if (result) {
return result;
Expand Down Expand Up @@ -97,7 +100,7 @@ function resolveSync(
const dir = path.dirname(name);
let result;
if (isDirectory(dir)) {
result = resolveAsDirectory(name) || resolveAsFile(name);
result = resolveAsFile(name) || resolveAsDirectory(name);
}
if (result) {
// Dereference symlinks to ensure we don't create a separate
Expand Down

0 comments on commit d9aaa1e

Please sign in to comment.