Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Immutable pretty-format plugins for Immutable.OrderedSet and Immu… #2899

Merged
merged 16 commits into from
Mar 6, 2017
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"react-test-renderer": "^15.4.1",
"rimraf": "^2.5.4",
"strip-ansi": "^3.0.1",
"typescript": "^2.1.4"
"typescript": "^2.1.4",
"immutable": "^3.8.1"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you insert this in the right alphabetical location please?

},
"scripts": {
"build-clean": "rm -rf ./packages/*/build",
Expand Down
3 changes: 2 additions & 1 deletion packages/jest-diff/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import type {DiffOptions} from './diffStrings';
const ReactElementPlugin = require('pretty-format/build/plugins/ReactElement');
const ReactTestComponentPlugin = require('pretty-format/build/plugins/ReactTestComponent');
const AsymmetricMatcherPlugin = require('pretty-format/build/plugins/AsymmetricMatcher');
const ImmutablePlugins = require('pretty-format/build/plugins/ImmutablePlugins');

const chalk = require('chalk');
const diffStrings = require('./diffStrings');
Expand All @@ -30,7 +31,7 @@ const PLUGINS = [
ReactTestComponentPlugin,
ReactElementPlugin,
AsymmetricMatcherPlugin,
];
].concat(ImmutablePlugins);
const FORMAT_OPTIONS = {
plugins: PLUGINS,
};
Expand Down
7 changes: 6 additions & 1 deletion packages/jest-matcher-utils/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,13 @@
const chalk = require('chalk');
const prettyFormat = require('pretty-format');
const AsymmetricMatcherPlugin = require('pretty-format/build/plugins/AsymmetricMatcher');
const ReactElementPlugin = require('pretty-format/build/plugins/ReactElement');
const ImmutablePlugins = require('pretty-format/build/plugins/ImmutablePlugins');

const PLUGINS = [AsymmetricMatcherPlugin];
const PLUGINS = [
AsymmetricMatcherPlugin,
ReactElementPlugin,
].concat(ImmutablePlugins);

export type ValueType =
| 'array'
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-snapshot/src/__tests__/plugins-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const testPath = names => {
it('gets plugins', () => {
const {getSerializers} = require('../plugins');
const plugins = getSerializers();
expect(plugins.length).toBe(2);
expect(plugins.length).toBe(8);
});

it('adds plugins from an empty array', () => testPath([]));
Expand Down
6 changes: 5 additions & 1 deletion packages/jest-snapshot/src/plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@

const ReactElementPlugin = require('pretty-format/build/plugins/ReactElement');
const ReactTestComponentPlugin = require('pretty-format/build/plugins/ReactTestComponent');
const ImmutablePlugins = require('pretty-format/build/plugins/ImmutablePlugins');

let PLUGINS = [ReactElementPlugin, ReactTestComponentPlugin];
let PLUGINS = [
ReactElementPlugin,
ReactTestComponentPlugin,
].concat(ImmutablePlugins);

// Prepend to list so the last added is the first tested.
exports.addSerializer = (plugin: any) => {
Expand Down
Loading