diff --git a/packages/jest-config/src/normalize.ts b/packages/jest-config/src/normalize.ts index d2fb805a906f..18c3afda778d 100644 --- a/packages/jest-config/src/normalize.ts +++ b/packages/jest-config/src/normalize.ts @@ -27,7 +27,6 @@ import { tryRealpath, } from 'jest-util'; import {ValidationError, validate} from 'jest-validate'; -import {DEFAULT_OPTIONS as PRETTY_FORMAT_DEFAULTS} from 'pretty-format'; import DEFAULT_CONFIG from './Defaults'; import DEPRECATED_CONFIG from './Deprecated'; import {validateReporters} from './ReporterValidationErrors'; diff --git a/packages/jest-jasmine2/src/setup_jest_globals.ts b/packages/jest-jasmine2/src/setup_jest_globals.ts index 1ee822998e33..9bd324aa3c49 100644 --- a/packages/jest-jasmine2/src/setup_jest_globals.ts +++ b/packages/jest-jasmine2/src/setup_jest_globals.ts @@ -106,12 +106,14 @@ export default async ({ patchJasmine(); const {expand, updateSnapshot} = globalConfig; - const {prettierPath} = config; + const {prettierPath, inlineSnapshotFormat, snapshotFormat} = config; const snapshotResolver = await buildSnapshotResolver(config, localRequire); const snapshotPath = snapshotResolver.resolveSnapshotPath(testPath); const snapshotState = new SnapshotState(snapshotPath, { expand, + inlineSnapshotFormat, prettierPath, + snapshotFormat, updateSnapshot, }); // @ts-expect-error: snapshotState is a jest extension of `expect` diff --git a/packages/jest-types/src/Config.ts b/packages/jest-types/src/Config.ts index fafa474efcf8..d6fb20a769b5 100644 --- a/packages/jest-types/src/Config.ts +++ b/packages/jest-types/src/Config.ts @@ -8,7 +8,6 @@ import type {ForegroundColor} from 'chalk'; import type {ReportOptions} from 'istanbul-reports'; import type {Arguments} from 'yargs'; -import type {OptionsReceived as PrettyFormatOptions} from 'pretty-format'; type CoverageProvider = 'babel' | 'v8'; @@ -61,6 +60,9 @@ export interface ConfigGlobals { [K: string]: unknown; } +// This interface gets filled out when pretty-format is included +interface PrettyFormatOptions {} + export type DefaultOptions = { automock: boolean; bail: number; diff --git a/packages/jest-types/src/index.ts b/packages/jest-types/src/index.ts index 8255474b61ba..30822b9fd3fa 100644 --- a/packages/jest-types/src/index.ts +++ b/packages/jest-types/src/index.ts @@ -1,3 +1,4 @@ + /** * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. * diff --git a/packages/pretty-format/src/types.ts b/packages/pretty-format/src/types.ts index e27dd61ea5e9..cb7413069436 100644 --- a/packages/pretty-format/src/types.ts +++ b/packages/pretty-format/src/types.ts @@ -46,7 +46,7 @@ export type Options = { theme: Theme; }; -export type OptionsReceived = { +export interface PrettyFormatOptions { callToJSON?: boolean; escapeRegex?: boolean; escapeString?: boolean; @@ -58,7 +58,9 @@ export type OptionsReceived = { printBasicPrototype?: boolean; printFunctionName?: boolean; theme?: ThemeReceived; -}; +} + +export type OptionsReceived = PrettyFormatOptions; export type Config = { callToJSON: boolean;