diff --git a/packages/pretty-format/src/index.js b/packages/pretty-format/src/index.js index 1baab04fe05b..dbe1dcdb18d8 100644 --- a/packages/pretty-format/src/index.js +++ b/packages/pretty-format/src/index.js @@ -36,14 +36,12 @@ type Theme = {| type InitialOptions = {| callToJSON?: boolean, escapeRegex?: boolean, - edgeSpacing?: string, highlight?: boolean, indent?: number, maxDepth?: number, min?: boolean, plugins?: Plugins, printFunctionName?: boolean, - spacing?: string, theme?: Theme, |}; @@ -794,7 +792,6 @@ function print( const DEFAULTS: Options = { callToJSON: true, - edgeSpacing: '\n', escapeRegex: false, highlight: false, indent: 2, @@ -802,7 +799,6 @@ const DEFAULTS: Options = { min: false, plugins: [], printFunctionName: true, - spacing: '\n', theme: { comment: 'gray', content: 'reset', diff --git a/packages/pretty-format/src/plugins/asymmetric_matcher.js b/packages/pretty-format/src/plugins/asymmetric_matcher.js index e49beb74a3f1..b98d4b484ae9 100644 --- a/packages/pretty-format/src/plugins/asymmetric_matcher.js +++ b/packages/pretty-format/src/plugins/asymmetric_matcher.js @@ -8,7 +8,13 @@ * @flow */ -import type {Colors, Indent, Options, Print, Plugin} from 'types/PrettyFormat'; +import type { + Colors, + Indent, + PluginOptions, + Print, + Plugin, +} from 'types/PrettyFormat'; const asymmetricMatcher = Symbol.for('jest.asymmetricMatcher'); const SPACE = ' '; @@ -20,7 +26,7 @@ const print = ( val: any, print: Print, indent: Indent, - opts: Options, + opts: PluginOptions, colors: Colors, ) => { const stringedValue = val.toString(); diff --git a/packages/pretty-format/src/plugins/convert_ansi.js b/packages/pretty-format/src/plugins/convert_ansi.js index b3bccc2e0859..9c60fc5369fe 100644 --- a/packages/pretty-format/src/plugins/convert_ansi.js +++ b/packages/pretty-format/src/plugins/convert_ansi.js @@ -8,7 +8,13 @@ * @flow */ -import type {Colors, Indent, Options, Print, Plugin} from 'types/PrettyFormat'; +import type { + Colors, + Indent, + PluginOptions, + Print, + Plugin, +} from 'types/PrettyFormat'; import ansiRegex from 'ansi-regex'; import style from 'ansi-styles'; @@ -42,7 +48,7 @@ const print = ( val: any, print: Print, indent: Indent, - opts: Options, + opts: PluginOptions, colors: Colors, ) => print(toHumanReadableAnsi(val)); diff --git a/packages/pretty-format/src/plugins/html_element.js b/packages/pretty-format/src/plugins/html_element.js index d840effdc668..769834591531 100644 --- a/packages/pretty-format/src/plugins/html_element.js +++ b/packages/pretty-format/src/plugins/html_element.js @@ -8,7 +8,13 @@ * @flow */ -import type {Colors, Indent, Options, Print, Plugin} from 'types/PrettyFormat'; +import type { + Colors, + Indent, + PluginOptions, + Print, + Plugin, +} from 'types/PrettyFormat'; import escapeHTML from './lib/escape_html'; @@ -80,7 +86,7 @@ const print = ( element: HTMLElement | HTMLText | HTMLComment, print: Print, indent: Indent, - opts: Options, + opts: PluginOptions, colors: Colors, ): string => { if (element.nodeType === 3) { diff --git a/packages/pretty-format/src/plugins/immutable_list.js b/packages/pretty-format/src/plugins/immutable_list.js index 0c02d164252b..0cc3b9019e5b 100644 --- a/packages/pretty-format/src/plugins/immutable_list.js +++ b/packages/pretty-format/src/plugins/immutable_list.js @@ -8,7 +8,13 @@ * @flow */ -import type {Colors, Indent, Options, Print, Plugin} from 'types/PrettyFormat'; +import type { + Colors, + Indent, + PluginOptions, + Print, + Plugin, +} from 'types/PrettyFormat'; import printImmutable from './lib/print_immutable'; @@ -19,7 +25,7 @@ const print = ( val: any, print: Print, indent: Indent, - opts: Options, + opts: PluginOptions, colors: Colors, ) => printImmutable(val, print, indent, opts, colors, 'List', false); diff --git a/packages/pretty-format/src/plugins/immutable_map.js b/packages/pretty-format/src/plugins/immutable_map.js index f66aaa2cf145..0b55744ec388 100644 --- a/packages/pretty-format/src/plugins/immutable_map.js +++ b/packages/pretty-format/src/plugins/immutable_map.js @@ -8,7 +8,13 @@ * @flow */ -import type {Colors, Indent, Options, Print, Plugin} from 'types/PrettyFormat'; +import type { + Colors, + Indent, + PluginOptions, + Print, + Plugin, +} from 'types/PrettyFormat'; import printImmutable from './lib/print_immutable'; @@ -21,7 +27,7 @@ const print = ( val: any, print: Print, indent: Indent, - opts: Options, + opts: PluginOptions, colors: Colors, ) => printImmutable(val, print, indent, opts, colors, 'Map', true); diff --git a/packages/pretty-format/src/plugins/immutable_ordered_map.js b/packages/pretty-format/src/plugins/immutable_ordered_map.js index ded415e2c650..7ceb2201bddf 100644 --- a/packages/pretty-format/src/plugins/immutable_ordered_map.js +++ b/packages/pretty-format/src/plugins/immutable_ordered_map.js @@ -8,7 +8,13 @@ * @flow */ -import type {Colors, Indent, Options, Print, Plugin} from 'types/PrettyFormat'; +import type { + Colors, + Indent, + PluginOptions, + Print, + Plugin, +} from 'types/PrettyFormat'; import printImmutable from './lib/print_immutable'; @@ -21,7 +27,7 @@ const print = ( val: any, print: Print, indent: Indent, - opts: Options, + opts: PluginOptions, colors: Colors, ) => printImmutable(val, print, indent, opts, colors, 'OrderedMap', true); diff --git a/packages/pretty-format/src/plugins/immutable_ordered_set.js b/packages/pretty-format/src/plugins/immutable_ordered_set.js index e43dbe5d570e..a64be1e26ab5 100644 --- a/packages/pretty-format/src/plugins/immutable_ordered_set.js +++ b/packages/pretty-format/src/plugins/immutable_ordered_set.js @@ -8,7 +8,13 @@ * @flow */ -import type {Colors, Indent, Options, Print, Plugin} from 'types/PrettyFormat'; +import type { + Colors, + Indent, + PluginOptions, + Print, + Plugin, +} from 'types/PrettyFormat'; import printImmutable from './lib/print_immutable'; @@ -21,7 +27,7 @@ const print = ( val: any, print: Print, indent: Indent, - opts: Options, + opts: PluginOptions, colors: Colors, ) => printImmutable(val, print, indent, opts, colors, 'OrderedSet', false); diff --git a/packages/pretty-format/src/plugins/immutable_record.js b/packages/pretty-format/src/plugins/immutable_record.js index 7b25f21519db..15ade038896a 100644 --- a/packages/pretty-format/src/plugins/immutable_record.js +++ b/packages/pretty-format/src/plugins/immutable_record.js @@ -8,7 +8,13 @@ * @flow */ -import type {Colors, Indent, Options, Print, Plugin} from 'types/PrettyFormat'; +import type { + Colors, + Indent, + PluginOptions, + Print, + Plugin, +} from 'types/PrettyFormat'; import printImmutable from './lib/print_immutable'; @@ -19,7 +25,7 @@ const print = ( val: any, print: Print, indent: Indent, - opts: Options, + opts: PluginOptions, colors: Colors, ) => printImmutable(val, print, indent, opts, colors, 'Record', true); diff --git a/packages/pretty-format/src/plugins/immutable_set.js b/packages/pretty-format/src/plugins/immutable_set.js index 57ce45db5a5e..3ec171c80c57 100644 --- a/packages/pretty-format/src/plugins/immutable_set.js +++ b/packages/pretty-format/src/plugins/immutable_set.js @@ -8,7 +8,13 @@ * @flow */ -import type {Colors, Indent, Options, Print, Plugin} from 'types/PrettyFormat'; +import type { + Colors, + Indent, + PluginOptions, + Print, + Plugin, +} from 'types/PrettyFormat'; import printImmutable from './lib/print_immutable'; @@ -21,7 +27,7 @@ const print = ( val: any, print: Print, indent: Indent, - opts: Options, + opts: PluginOptions, colors: Colors, ) => printImmutable(val, print, indent, opts, colors, 'Set', false); diff --git a/packages/pretty-format/src/plugins/immutable_stack.js b/packages/pretty-format/src/plugins/immutable_stack.js index 75a22ce6160e..5f9a0ef4ad09 100644 --- a/packages/pretty-format/src/plugins/immutable_stack.js +++ b/packages/pretty-format/src/plugins/immutable_stack.js @@ -8,7 +8,13 @@ * @flow */ -import type {Colors, Indent, Options, Print, Plugin} from 'types/PrettyFormat'; +import type { + Colors, + Indent, + PluginOptions, + Print, + Plugin, +} from 'types/PrettyFormat'; import printImmutable from './lib/print_immutable'; @@ -19,7 +25,7 @@ const print = ( val: any, print: Print, indent: Indent, - opts: Options, + opts: PluginOptions, colors: Colors, ) => printImmutable(val, print, indent, opts, colors, 'Stack', false); diff --git a/packages/pretty-format/src/plugins/lib/print_immutable.js b/packages/pretty-format/src/plugins/lib/print_immutable.js index 715a79d2b207..0cbe0b412ceb 100644 --- a/packages/pretty-format/src/plugins/lib/print_immutable.js +++ b/packages/pretty-format/src/plugins/lib/print_immutable.js @@ -8,7 +8,7 @@ * @flow */ -import type {Colors, Indent, Options, Print} from 'types/PrettyFormat'; +import type {Colors, Indent, PluginOptions, Print} from 'types/PrettyFormat'; const IMMUTABLE_NAMESPACE = 'Immutable.'; const SPACE = ' '; @@ -22,7 +22,7 @@ const printImmutable = ( val: any, print: Print, indent: Indent, - opts: Options, + opts: PluginOptions, colors: Colors, immutableDataStructureName: string, isMap: boolean, diff --git a/packages/pretty-format/src/plugins/react_element.js b/packages/pretty-format/src/plugins/react_element.js index af996313a010..6f9d22f4155f 100644 --- a/packages/pretty-format/src/plugins/react_element.js +++ b/packages/pretty-format/src/plugins/react_element.js @@ -8,7 +8,13 @@ * @flow */ -import type {Colors, Indent, Options, Print, Plugin} from 'types/PrettyFormat'; +import type { + Colors, + Indent, + PluginOptions, + Print, + Plugin, +} from 'types/PrettyFormat'; import escapeHTML from './lib/escape_html'; @@ -71,7 +77,7 @@ const print = ( element: React$Element<*>, print: Print, indent: Indent, - opts: Options, + opts: PluginOptions, colors: Colors, ) => { let result = colors.tag.open + '<'; diff --git a/packages/pretty-format/src/plugins/react_test_component.js b/packages/pretty-format/src/plugins/react_test_component.js index 72d37449e619..11d48315d102 100644 --- a/packages/pretty-format/src/plugins/react_test_component.js +++ b/packages/pretty-format/src/plugins/react_test_component.js @@ -11,7 +11,7 @@ import type { Colors, Indent, - Options, + PluginOptions, Print, Plugin, ReactTestObject, @@ -73,7 +73,7 @@ const print = ( instance: ReactTestObject, print: Print, indent: Indent, - opts: Options, + opts: PluginOptions, colors: Colors, ) => { let closeInNewLine = false; diff --git a/types/PrettyFormat.js b/types/PrettyFormat.js index b8482e5fc4af..a2d8292bb4a8 100644 --- a/types/PrettyFormat.js +++ b/types/PrettyFormat.js @@ -22,7 +22,6 @@ export type StringOrNull = string | null; export type Options = {| callToJSON: boolean, - edgeSpacing: string, escapeRegex: boolean, highlight: boolean, indent: number, @@ -30,7 +29,6 @@ export type Options = {| min: boolean, plugins: Plugins, printFunctionName: boolean, - spacing: string, theme: {| comment: string, content: string, @@ -40,12 +38,18 @@ export type Options = {| |}, |}; +export type PluginOptions = {| + edgeSpacing: string, + min: boolean, + spacing: string, +|}; + export type Plugin = { print: ( val: any, serialize: Print, indent: Indent, - opts: Options, + opts: PluginOptions, colors: Colors, ) => string, test: any => boolean,