From 192a99f51df744c1088994ca114ef46294487e89 Mon Sep 17 00:00:00 2001 From: Mark Pedrotti Date: Mon, 7 Aug 2017 14:52:14 -0400 Subject: [PATCH] Replace concat(Immutable) with Immutable as item of plugins array (#4207) --- packages/jest-diff/src/index.js | 3 ++- packages/jest-matcher-utils/src/index.js | 3 ++- packages/jest-snapshot/src/plugins.js | 2 +- packages/pretty-format/src/__tests__/immutable.test.js | 9 +++++---- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/packages/jest-diff/src/index.js b/packages/jest-diff/src/index.js index d7976a25a909..129dbb2d5787 100644 --- a/packages/jest-diff/src/index.js +++ b/packages/jest-diff/src/index.js @@ -28,8 +28,9 @@ const PLUGINS = [ ReactTestComponent, ReactElement, HTMLElement, + Immutable, AsymmetricMatcher, -].concat(Immutable); +]; const FORMAT_OPTIONS = { plugins: PLUGINS, }; diff --git a/packages/jest-matcher-utils/src/index.js b/packages/jest-matcher-utils/src/index.js index effc9421b0a0..0ed181e2566b 100644 --- a/packages/jest-matcher-utils/src/index.js +++ b/packages/jest-matcher-utils/src/index.js @@ -23,8 +23,9 @@ const PLUGINS = [ ReactTestComponent, ReactElement, HTMLElement, + Immutable, AsymmetricMatcher, -].concat(Immutable); +]; const EXPECTED_COLOR = chalk.green; const EXPECTED_BG = chalk.bgGreen; diff --git a/packages/jest-snapshot/src/plugins.js b/packages/jest-snapshot/src/plugins.js index 58bf77c5624d..4fe82dafefc0 100644 --- a/packages/jest-snapshot/src/plugins.js +++ b/packages/jest-snapshot/src/plugins.js @@ -19,7 +19,7 @@ const { ReactTestComponent, } = prettyFormat.plugins; -let PLUGINS = [ReactTestComponent, ReactElement, HTMLElement].concat(Immutable); +let PLUGINS = [ReactTestComponent, ReactElement, HTMLElement, Immutable]; // Prepend to list so the last added is the first tested. exports.addSerializer = (plugin: Plugin) => { diff --git a/packages/pretty-format/src/__tests__/immutable.test.js b/packages/pretty-format/src/__tests__/immutable.test.js index f0e45b913f3f..059f4e52a5e6 100644 --- a/packages/pretty-format/src/__tests__/immutable.test.js +++ b/packages/pretty-format/src/__tests__/immutable.test.js @@ -13,12 +13,13 @@ import React from 'react'; import Immutable from 'immutable'; import prettyFormat from '../'; -const {Immutable: ImmutablePlugins, ReactElement} = prettyFormat.plugins; +const {Immutable: ImmutablePlugin, ReactElement} = prettyFormat.plugins; import expectUtil from './expect_util'; -const toPrettyPrintTo = expectUtil.getPrettyPrint( - [ReactElement].concat(ImmutablePlugins), -); +const toPrettyPrintTo = expectUtil.getPrettyPrint([ + ReactElement, + ImmutablePlugin, +]); const expect = global.expect; expect.extend({toPrettyPrintTo});