From 8555ae0bb8dfcc979bcf10c3b0f10903906f46c6 Mon Sep 17 00:00:00 2001 From: Mihail Bodrov Date: Thu, 2 May 2019 20:24:37 +0300 Subject: [PATCH 1/2] [jest-resolve] cache current directory path --- packages/jest-resolve/src/defaultResolver.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/jest-resolve/src/defaultResolver.ts b/packages/jest-resolve/src/defaultResolver.ts index 8a2e4c9d8c15..42a0d31ee939 100644 --- a/packages/jest-resolve/src/defaultResolver.ts +++ b/packages/jest-resolve/src/defaultResolver.ts @@ -188,6 +188,7 @@ function isDirectory(dir: Config.Path): boolean { return statSyncCached(dir) === IPathType.DIRECTORY; } +const CURRENT_DIRECTORY = path.resolve('.'); function isCurrentDirectory(testPath: Config.Path): boolean { - return path.resolve('.') === path.resolve(testPath); + return CURRENT_DIRECTORY === path.resolve(testPath); } From 673bd268261d97bd2d79a4338ac7979f86ed4e60 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Fri, 3 May 2019 08:39:40 +0200 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c62ad76c6881..cc809716cd2e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ - `[jest-runtime]` Fix module registry memory leak ([#8282](https://github.com/facebook/jest/pull/8282)) - `[jest-resolve]` optimize resolve module path ([#8388](https://github.com/facebook/jest/pull/8388)) +- `[jest-resolve]` cache current directory ([#8412](https://github.com/facebook/jest/pull/8412)) ## 24.7.1