From b032ef5e074eea2e5a5677719a13bc6c79ed33c5 Mon Sep 17 00:00:00 2001 From: Ian VanSchooten Date: Fri, 10 Sep 2021 17:17:10 -0400 Subject: [PATCH] Apply changes from #11817 to async method --- packages/jest-resolve/src/resolver.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/jest-resolve/src/resolver.ts b/packages/jest-resolve/src/resolver.ts index 00f31d7088c9..3319cfce7a0a 100644 --- a/packages/jest-resolve/src/resolver.ts +++ b/packages/jest-resolve/src/resolver.ts @@ -733,8 +733,12 @@ export default class Resolver { const resolveNodeModule = async ( name: Config.Path, throwIfNotFound = false, - ) => - await Resolver.findNodeModuleAsync(name, { + ) => { + if (this.isCoreModule(name)) { + return name; + } + + return await Resolver.findNodeModuleAsync(name, { basedir: dirname, conditions: options?.conditions, extensions, @@ -744,6 +748,7 @@ export default class Resolver { rootDir: this._options.rootDir, throwIfNotFound, }); + }; if (!skipResolution) { module = await resolveNodeModule(