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

Method createHasteMap

packages/jest-runtime/src/index.ts:302–341  ·  view source on GitHub ↗
(
    config: Config.ProjectConfig,
    options?: HasteMapOptions,
  )

Source from the content-addressed store, hash-verified

300 }
301
302 static createHasteMap(
303 config: Config.ProjectConfig,
304 options?: HasteMapOptions,
305 ): Promise<IHasteMap> {
306 const ignorePatternParts = [
307 ...config.modulePathIgnorePatterns,
308 ...(options && options.watch ? config.watchPathIgnorePatterns : []),
309 config.cacheDirectory.startsWith(config.rootDir + path.sep) &&
310 config.cacheDirectory,
311 ].filter(Boolean);
312 const ignorePattern =
313 ignorePatternParts.length > 0
314 ? new RegExp(ignorePatternParts.join('|'))
315 : undefined;
316
317 return HasteMap.create({
318 cacheDirectory: config.cacheDirectory,
319 computeSha1: config.haste.computeSha1,
320 console: options?.console,
321 dependencyExtractor: config.dependencyExtractor,
322 enableSymlinks: config.haste.enableSymlinks,
323 extensions: [SnapshotExtension, ...config.moduleFileExtensions],
324 forceNodeFilesystemAPI: config.haste.forceNodeFilesystemAPI,
325 hasteImplModulePath: config.haste.hasteImplModulePath,
326 hasteMapModulePath: config.haste.hasteMapModulePath,
327 id: config.id,
328 ignorePattern,
329 maxWorkers: options?.maxWorkers || 1,
330 mocksPattern: escapePathForRegex(`${path.sep}__mocks__${path.sep}`),
331 platforms: config.haste.platforms || ['ios', 'android'],
332 resetCache: options?.resetCache,
333 retainAllFiles: config.haste.retainAllFiles || false,
334 rootDir: config.rootDir,
335 roots: config.roots,
336 throwOnModuleCollision: config.haste.throwOnModuleCollision,
337 useWatchman: options?.watchman,
338 watch: options?.watch,
339 workerThreads: options?.workerThreads,
340 });
341 }
342
343 static createResolver(
344 config: Config.ProjectConfig,

Callers 5

createContextMethod · 0.80
createRuntime.jsFile · 0.80

Calls 2

escapePathForRegexFunction · 0.90
createMethod · 0.45

Tested by

no test coverage detected