jest-resolve
Advanced tools
Comparing version
@@ -154,2 +154,3 @@ /** | ||
isCoreModule(moduleName: string): boolean; | ||
normalizeCoreModuleSpecifier(specifier: string): string; | ||
getModule(name: string): string | null; | ||
@@ -156,0 +157,0 @@ getModulePath(from: string, moduleName: string): string; |
@@ -947,2 +947,5 @@ /*! | ||
} | ||
normalizeCoreModuleSpecifier(specifier) { | ||
return specifier.startsWith('node:') ? specifier.slice('node:'.length) : specifier; | ||
} | ||
getModule(name) { | ||
@@ -965,5 +968,5 @@ return this._moduleMap.getModule(name, this._options.defaultPlatform, this._supportsNativePlatform); | ||
} else { | ||
const moduleName = this.resolveStubModuleName(from, name, options); | ||
if (moduleName) { | ||
return this.getModule(moduleName) || moduleName; | ||
const resolvedName = this.resolveStubModuleName(from, name, options); | ||
if (resolvedName) { | ||
return this._moduleMap.getMockModule(resolvedName) ?? null; | ||
} | ||
@@ -978,5 +981,5 @@ } | ||
} else { | ||
const moduleName = await this.resolveStubModuleNameAsync(from, name, options); | ||
if (moduleName) { | ||
return this.getModule(moduleName) || moduleName; | ||
const resolvedName = await this.resolveStubModuleNameAsync(from, name, options); | ||
if (resolvedName) { | ||
return this._moduleMap.getMockModule(resolvedName) ?? null; | ||
} | ||
@@ -1046,3 +1049,3 @@ } | ||
if (this.isCoreModule(moduleName)) { | ||
return moduleName; | ||
return this.normalizeCoreModuleSpecifier(moduleName); | ||
} | ||
@@ -1130,2 +1133,6 @@ if (moduleName.startsWith('data:')) { | ||
async resolveStubModuleNameAsync(from, moduleName, options) { | ||
// Strip node URL scheme from core modules imported using it | ||
if (this.isCoreModule(moduleName)) { | ||
return this.normalizeCoreModuleSpecifier(moduleName); | ||
} | ||
const dirname = path().dirname(from); | ||
@@ -1132,0 +1139,0 @@ const { |
{ | ||
"name": "jest-resolve", | ||
"version": "30.0.0-beta.4", | ||
"version": "30.0.0-beta.5", | ||
"repository": { | ||
@@ -24,3 +24,3 @@ "type": "git", | ||
"graceful-fs": "^4.2.9", | ||
"jest-haste-map": "30.0.0-beta.4", | ||
"jest-haste-map": "30.0.0-beta.5", | ||
"jest-pnp-resolver": "^1.2.3", | ||
@@ -44,3 +44,3 @@ "jest-util": "30.0.0-beta.3", | ||
}, | ||
"gitHead": "69f0c890c804e6e6b0822adb592cd00372a7c297" | ||
"gitHead": "f2171bb4c6836d74ad2b32a48151d9e0fdfa20a2" | ||
} |
64516
0.67%1762
0.46%+ Added
- Removed
Updated