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 all 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
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"flow-bin": "^0.39.0",
"glob": "^7.1.1",
"graceful-fs": "^4.1.11",
"immutable": "^3.8.1",
"istanbul-api": "^1.1.0",
"istanbul-lib-coverage": "^1.0.0",
"jasmine-reporters": "^2.2.0",
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