Skip to content

Commit 46afa44

Browse files
ConnormihaSimenB
authored andcommitted
[jest-resolve] cache current directory path (#8412)
1 parent b870306 commit 46afa44

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040

4141
- `[jest-runtime]` Fix module registry memory leak ([#8282](https://github.com/facebook/jest/pull/8282))
4242
- `[jest-resolve]` optimize resolve module path ([#8388](https://github.com/facebook/jest/pull/8388))
43+
- `[jest-resolve]` cache current directory ([#8412](https://github.com/facebook/jest/pull/8412))
4344

4445
## 24.7.1
4546

packages/jest-resolve/src/defaultResolver.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ function isDirectory(dir: Config.Path): boolean {
188188
return statSyncCached(dir) === IPathType.DIRECTORY;
189189
}
190190

191+
const CURRENT_DIRECTORY = path.resolve('.');
191192
function isCurrentDirectory(testPath: Config.Path): boolean {
192-
return path.resolve('.') === path.resolve(testPath);
193+
return CURRENT_DIRECTORY === path.resolve(testPath);
193194
}

0 commit comments

Comments
 (0)