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

Function getModuleNameMapper

packages/jest-runtime/src/index.ts:86–97  ·  view source on GitHub ↗
(config: Config.ProjectConfig)

Source from the content-addressed store, hash-verified

84const NODE_MODULES = `${path.sep}node_modules${path.sep}`;
85
86const getModuleNameMapper = (config: Config.ProjectConfig) => {
87 if (
88 Array.isArray(config.moduleNameMapper) &&
89 config.moduleNameMapper.length > 0
90 ) {
91 return config.moduleNameMapper.map(([regex, moduleName]) => ({
92 moduleName,
93 regex: new RegExp(regex),
94 }));
95 }
96 return null;
97};
98
99export default class Runtime {
100 private readonly fileCache: FileCache;

Callers 1

createResolverMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected