MCPcopy
hub / github.com/jestjs/jest / requireInternalModule

Method requireInternalModule

packages/jest-runtime/src/index.ts:386–405  ·  view source on GitHub ↗
(from: string, to?: string)

Source from the content-addressed store, hash-verified

384 }
385
386 requireInternalModule<T = unknown>(from: string, to?: string): T {
387 if (to) {
388 const require = nativeModule.createRequire(from);
389 if (INTERNAL_MODULE_REQUIRE_OUTSIDE_OPTIMIZED_MODULES.has(to)) {
390 return require(to);
391 }
392 const outsideJestVmPath = decodePossibleOutsideJestVmPath(to);
393 if (outsideJestVmPath) {
394 return require(outsideJestVmPath);
395 }
396 }
397
398 return this.requireModule<T>(from, to, {
399 isInternalModule: true,
400 supportsDynamicImport: runtimeSupportsVmModules,
401 supportsExportNamespaceFrom: false,
402 supportsStaticESM: false,
403 supportsTopLevelAwait: false,
404 });
405 }
406
407 requireActual<T = unknown>(from: string, moduleName: string): T {
408 if (FRAMEWORK_SINGLETON_MODULES.has(moduleName)) {

Calls 3

requireModuleMethod · 0.95
createRequireMethod · 0.80

Tested by

no test coverage detected