Function configureJest

  • Configures Jest tests for the project.

    Loads project configuration first.

    Parameters

    • Optionaloptions: Partial<{
          automock: boolean;
          bail: number | boolean;
          cache: boolean;
          cacheDirectory: string;
          changedFilesWithAncestor: boolean;
          changedSince: string;
          ci: boolean;
          clearMocks: boolean;
          collectCoverage: boolean;
          collectCoverageFrom: string[];
          coverageDirectory: string;
          coveragePathIgnorePatterns: string[];
          coverageProvider: CoverageProvider;
          coverageReporters: CoverageReporters;
          coverageThreshold: CoverageThreshold;
          dependencyExtractor: string;
          detectLeaks: boolean;
          detectOpenHandles: boolean;
          displayName: string | DisplayName;
          errorOnDeprecated: boolean;
          expand: boolean;
          extensionsToTreatAsEsm: string[];
          fakeTimers: FakeTimers;
          filter: string;
          findRelatedTests: boolean;
          forceCoverageMatch: string[];
          forceExit: boolean;
          globals: ConfigGlobals;
          globalSetup: undefined | null | string;
          globalTeardown: undefined | null | string;
          haste: HasteConfig;
          id: string;
          injectGlobals: boolean;
          json: boolean;
          lastCommit: boolean;
          listTests: boolean;
          logHeapUsage: boolean;
          maxConcurrency: number;
          maxWorkers: string | number;
          moduleDirectories: string[];
          moduleFileExtensions: string[];
          moduleNameMapper: {
              [key: string]: string | string[];
          };
          modulePathIgnorePatterns: string[];
          modulePaths: string[];
          noStackTrace: boolean;
          notify: boolean;
          notifyMode: string;
          onlyChanged: boolean;
          onlyFailures: boolean;
          openHandlesTimeout: number;
          outputFile: string;
          passWithNoTests: boolean;
          preset: undefined | null | string;
          prettierPath: undefined | null | string;
          projects: (string | InitialProjectOptions)[];
          randomize: boolean;
          replname: undefined | null | string;
          reporters: (string | ReporterConfig)[];
          resetMocks: boolean;
          resetModules: boolean;
          resolver: undefined | null | string;
          restoreMocks: boolean;
          rootDir: string;
          roots: string[];
          runner: string;
          runTestsByPath: boolean;
          runtime: string;
          sandboxInjectedGlobals: string[];
          setupFiles: string[];
          setupFilesAfterEnv: string[];
          showSeed: boolean;
          silent: boolean;
          skipFilter: boolean;
          skipNodeResolution: boolean;
          slowTestThreshold: number;
          snapshotFormat: {
              callToJSON?: boolean;
              compareKeys?: null;
              escapeRegex?: boolean;
              escapeString?: boolean;
              highlight?: boolean;
              indent?: number;
              maxDepth?: number;
              maxWidth?: number;
              min?: boolean;
              printBasicPrototype?: boolean;
              printFunctionName?: boolean;
              theme?: {
                  comment?: string;
                  content?: string;
                  prop?: string;
                  tag?: string;
                  value?: string;
              };
          };
          snapshotResolver: string;
          snapshotSerializers: string[];
          testEnvironment: string;
          testEnvironmentOptions: Record<string, unknown>;
          testFailureExitCode: string | number;
          testLocationInResults: boolean;
          testMatch: string[];
          testNamePattern: string;
          testPathIgnorePatterns: string[];
          testRegex: string | string[];
          testResultsProcessor: string;
          testRunner: string;
          testSequencer: string;
          testTimeout: number;
          transform: {
              [regex: string]: string | TransformerConfig;
          };
          transformIgnorePatterns: string[];
          unmockedModulePathPatterns: string[];
          updateSnapshot: boolean;
          useStderr: boolean;
          verbose?: boolean;
          watch: boolean;
          watchAll: boolean;
          watchman: boolean;
          watchPathIgnorePatterns: string[];
          watchPlugins: (string | [string, Record<string, unknown>])[];
          workerIdleMemoryLimit: string | number;
          workerThreads: boolean;
      }>

      Jest configuration options extending default ones.

    Returns Promise<Config.InitialOptions>

    Promise resolved to Jest options.