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

Function _run10000

packages/jest-core/src/cli/index.ts:173–248  ·  view source on GitHub ↗
(
  globalConfig: Config.GlobalConfig,
  configs: Array<Config.ProjectConfig>,
  hasDeprecationWarnings: boolean,
  outputStream: WriteStream,
  onComplete: OnCompleteCallback,
)

Source from the content-addressed store, hash-verified

171};
172
173const _run10000 = async (
174 globalConfig: Config.GlobalConfig,
175 configs: Array<Config.ProjectConfig>,
176 hasDeprecationWarnings: boolean,
177 outputStream: WriteStream,
178 onComplete: OnCompleteCallback,
179) => {
180 // Queries to hg/git can take a while, so we need to start the process
181 // as soon as possible, so by the time we need the result it's already there.
182 const changedFilesPromise = getChangedFilesPromise(globalConfig, configs);
183 if (changedFilesPromise) {
184 performance.mark('jest/getChangedFiles:start');
185 changedFilesPromise.finally(() => {
186 performance.mark('jest/getChangedFiles:end');
187 });
188 }
189
190 // Filter may need to do an HTTP call or something similar to setup.
191 // We will wait on an async response from this before using the filter.
192 let filter: Filter | undefined;
193 if (globalConfig.filter && !globalConfig.skipFilter) {
194 const rawFilter = require(globalConfig.filter);
195 let filterSetupPromise: Promise<unknown | undefined> | undefined;
196 if (rawFilter.setup) {
197 // Wrap filter setup Promise to avoid "uncaught Promise" error.
198 // If an error is returned, we surface it in the return value.
199 filterSetupPromise = (async () => {
200 try {
201 await rawFilter.setup();
202 } catch (error) {
203 return error;
204 }
205 return undefined;
206 })();
207 }
208 filter = async (testPaths: Array<string>) => {
209 if (filterSetupPromise) {
210 // Expect an undefined return value unless there was an error.
211 const err = await filterSetupPromise;
212 if (err) {
213 throw err;
214 }
215 }
216 return rawFilter(testPaths);
217 };
218 }
219
220 performance.mark('jest/buildContextsAndHasteMaps:start');
221 const {contexts, hasteMapInstances} = await buildContextsAndHasteMaps(
222 configs,
223 globalConfig,
224 outputStream,
225 );
226 performance.mark('jest/buildContextsAndHasteMaps:end');
227
228 if (globalConfig.watch || globalConfig.watchAll) {
229 await runWatch(
230 contexts,

Callers 1

runCLIFunction · 0.85

Calls 5

getChangedFilesPromiseFunction · 0.85
runWatchFunction · 0.85
runWithoutWatchFunction · 0.85
setupMethod · 0.45

Tested by

no test coverage detected