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

Function buildContextsAndHasteMaps

packages/jest-core/src/cli/index.ts:143–171  ·  view source on GitHub ↗
(
  configs: Array<Config.ProjectConfig>,
  globalConfig: Config.GlobalConfig,
  outputStream: WriteStream,
)

Source from the content-addressed store, hash-verified

141}
142
143const buildContextsAndHasteMaps = async (
144 configs: Array<Config.ProjectConfig>,
145 globalConfig: Config.GlobalConfig,
146 outputStream: WriteStream,
147) => {
148 const hasteMapInstances = Array.from<IHasteMap>({
149 length: configs.length,
150 });
151 const contexts = await Promise.all(
152 configs.map(async (config, index) => {
153 createDirectory(config.cacheDirectory);
154 const hasteMapInstance = await Runtime.createHasteMap(config, {
155 console: new CustomConsole(outputStream, outputStream),
156 maxWorkers: Math.max(
157 1,
158 Math.floor(globalConfig.maxWorkers / configs.length),
159 ),
160 resetCache: !config.cache,
161 watch: globalConfig.watch || globalConfig.watchAll,
162 watchman: globalConfig.watchman,
163 workerThreads: globalConfig.workerThreads,
164 });
165 hasteMapInstances[index] = hasteMapInstance;
166 return createContext(config, await hasteMapInstance.build());
167 }),
168 );
169
170 return {contexts, hasteMapInstances};
171};
172
173const _run10000 = async (
174 globalConfig: Config.GlobalConfig,

Callers 1

_run10000Function · 0.85

Calls 4

createDirectoryFunction · 0.90
createContextFunction · 0.85
createHasteMapMethod · 0.80
buildMethod · 0.65

Tested by

no test coverage detected