/
plugins.ts
39 lines (34 loc) · 934 Bytes
/
plugins.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import {
Plugin as PrettyFormatPlugin,
Plugins as PrettyFormatPlugins,
plugins as prettyFormatPlugins,
} from 'pretty-format';
import jestMockSerializer from './mockSerializer';
const {
DOMCollection,
DOMElement,
Immutable,
ReactElement,
ReactTestComponent,
AsymmetricMatcher,
} = prettyFormatPlugins;
let PLUGINS: PrettyFormatPlugins = [
ReactTestComponent,
ReactElement,
DOMElement,
DOMCollection,
Immutable,
jestMockSerializer,
AsymmetricMatcher,
];
// Prepend to list so the last added is the first tested.
export const addSerializer = (plugin: PrettyFormatPlugin): void => {
PLUGINS = [plugin].concat(PLUGINS);
};
export const getSerializers = (): PrettyFormatPlugins => PLUGINS;