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

Function normalize

packages/jest-config/src/normalize.ts:534–1267  ·  view source on GitHub ↗
(
  initialOptions: Config.InitialOptions,
  argv: Config.Argv,
  configPath?: string | null,
  projectIndex = Number.POSITIVE_INFINITY,
  isProjectOptions?: boolean,
)

Source from the content-addressed store, hash-verified

532}
533
534export default async function normalize(
535 initialOptions: Config.InitialOptions,
536 argv: Config.Argv,
537 configPath?: string | null,
538 projectIndex = Number.POSITIVE_INFINITY,
539 isProjectOptions?: boolean,
540): Promise<{
541 hasDeprecationWarnings: boolean;
542 options: AllOptions;
543}> {
544 const {hasDeprecationWarnings} = validate(initialOptions, {
545 comment: DOCUMENTATION_NOTE,
546 deprecatedConfig: DEPRECATED_CONFIG,
547 exampleConfig: isProjectOptions ? VALID_PROJECT_CONFIG : VALID_CONFIG,
548 recursiveDenylist: [
549 // 'coverageThreshold' allows to use 'global' and glob strings on the same
550 // level, there's currently no way we can deal with such config
551 'coverageThreshold',
552 'globals',
553 'moduleNameMapper',
554 'testEnvironmentOptions',
555 'transform',
556 ],
557 ...(isProjectOptions && {unknown: unknownProjectOption}),
558 });
559
560 let options = normalizeMissingOptions(
561 normalizeRootDir(setFromArgv(initialOptions, argv)),
562 configPath,
563 projectIndex,
564 );
565
566 if (options.preset) {
567 options = await setupPreset(options, options.preset);
568 }
569
570 if (!options.setupFilesAfterEnv) {
571 options.setupFilesAfterEnv = [];
572 }
573
574 options.testEnvironment = resolveTestEnvironment({
575 requireResolveFunction: requireResolve,
576 rootDir: options.rootDir,
577 testEnvironment:
578 options.testEnvironment ||
579 require.resolve(DEFAULT_CONFIG.testEnvironment),
580 });
581
582 if (!options.roots) {
583 options.roots = [options.rootDir];
584 }
585
586 if (
587 !options.testRunner ||
588 options.testRunner === 'circus' ||
589 options.testRunner === 'jest-circus' ||
590 options.testRunner === 'jest-circus/runner'
591 ) {

Callers 6

initSearchSourceFunction · 0.90
readConfigFunction · 0.70
normalize.test.tsFile · 0.50
testPathArrayFunction · 0.50
cleanE2e.mjsFile · 0.50

Calls 15

validateFunction · 0.90
resolveTestEnvironmentFunction · 0.90
resolveFunction · 0.90
replaceRootDirInPathFunction · 0.90
resolveRunnerFunction · 0.90
_replaceRootDirTagsFunction · 0.90
escapeGlobCharactersFunction · 0.90
replacePathSepForGlobFunction · 0.90
getDisplayNameColorFunction · 0.90
resolveWatchPluginFunction · 0.90
tryRealpathFunction · 0.90
resolveSequencerFunction · 0.90

Tested by 2

initSearchSourceFunction · 0.72
testPathArrayFunction · 0.40