1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | import type {SnapshotFormat} from '@jest/schemas';
|
8 |
|
9 | export declare type Colors = {
|
10 | comment: {
|
11 | close: string;
|
12 | open: string;
|
13 | };
|
14 | content: {
|
15 | close: string;
|
16 | open: string;
|
17 | };
|
18 | prop: {
|
19 | close: string;
|
20 | open: string;
|
21 | };
|
22 | tag: {
|
23 | close: string;
|
24 | open: string;
|
25 | };
|
26 | value: {
|
27 | close: string;
|
28 | open: string;
|
29 | };
|
30 | };
|
31 |
|
32 | export declare type CompareKeys =
|
33 | | ((a: string, b: string) => number)
|
34 | | null
|
35 | | undefined;
|
36 |
|
37 | export declare type Config = {
|
38 | callToJSON: boolean;
|
39 | compareKeys: CompareKeys;
|
40 | colors: Colors;
|
41 | escapeRegex: boolean;
|
42 | escapeString: boolean;
|
43 | indent: string;
|
44 | maxDepth: number;
|
45 | maxWidth: number;
|
46 | min: boolean;
|
47 | plugins: Plugins;
|
48 | printBasicPrototype: boolean;
|
49 | printFunctionName: boolean;
|
50 | spacingInner: string;
|
51 | spacingOuter: string;
|
52 | };
|
53 |
|
54 | export declare const DEFAULT_OPTIONS: {
|
55 | callToJSON: true;
|
56 | compareKeys: undefined;
|
57 | escapeRegex: false;
|
58 | escapeString: true;
|
59 | highlight: false;
|
60 | indent: number;
|
61 | maxDepth: number;
|
62 | maxWidth: number;
|
63 | min: false;
|
64 | plugins: never[];
|
65 | printBasicPrototype: true;
|
66 | printFunctionName: true;
|
67 | theme: Required<{
|
68 | readonly comment?: string | undefined;
|
69 | readonly content?: string | undefined;
|
70 | readonly prop?: string | undefined;
|
71 | readonly tag?: string | undefined;
|
72 | readonly value?: string | undefined;
|
73 | }>;
|
74 | };
|
75 |
|
76 | /**
|
77 | * Returns a presentation string of your `val` object
|
78 | * @param val any potential JavaScript object
|
79 | * @param options Custom settings
|
80 | */
|
81 | declare function format(val: unknown, options?: OptionsReceived): string;
|
82 | export default format;
|
83 | export {format};
|
84 |
|
85 | declare type Indent = (arg0: string) => string;
|
86 |
|
87 | export declare type NewPlugin = {
|
88 | serialize: (
|
89 | val: any,
|
90 | config: Config,
|
91 | indentation: string,
|
92 | depth: number,
|
93 | refs: Refs,
|
94 | printer: Printer,
|
95 | ) => string;
|
96 | test: Test;
|
97 | };
|
98 |
|
99 | export declare type OldPlugin = {
|
100 | print: (
|
101 | val: unknown,
|
102 | print: Print,
|
103 | indent: Indent,
|
104 | options: PluginOptions,
|
105 | colors: Colors,
|
106 | ) => string;
|
107 | test: Test;
|
108 | };
|
109 |
|
110 | export declare interface Options
|
111 | extends Omit<RequiredOptions, 'compareKeys' | 'theme'> {
|
112 | compareKeys: CompareKeys;
|
113 | theme: Required<RequiredOptions['theme']>;
|
114 | }
|
115 |
|
116 | export declare type OptionsReceived = PrettyFormatOptions;
|
117 |
|
118 | declare type Plugin_2 = NewPlugin | OldPlugin;
|
119 | export {Plugin_2 as Plugin};
|
120 |
|
121 | declare type PluginOptions = {
|
122 | edgeSpacing: string;
|
123 | min: boolean;
|
124 | spacing: string;
|
125 | };
|
126 |
|
127 | export declare type Plugins = Array<Plugin_2>;
|
128 |
|
129 | export declare const plugins: {
|
130 | AsymmetricMatcher: NewPlugin;
|
131 | DOMCollection: NewPlugin;
|
132 | DOMElement: NewPlugin;
|
133 | Immutable: NewPlugin;
|
134 | ReactElement: NewPlugin;
|
135 | ReactTestComponent: NewPlugin;
|
136 | };
|
137 |
|
138 | export declare interface PrettyFormatOptions
|
139 | extends Omit<SnapshotFormat, 'compareKeys'> {
|
140 | compareKeys?: CompareKeys;
|
141 | plugins?: Plugins;
|
142 | }
|
143 |
|
144 | declare type Print = (arg0: unknown) => string;
|
145 |
|
146 | export declare type Printer = (
|
147 | val: unknown,
|
148 | config: Config,
|
149 | indentation: string,
|
150 | depth: number,
|
151 | refs: Refs,
|
152 | hasCalledToJSON?: boolean,
|
153 | ) => string;
|
154 |
|
155 | export declare type Refs = Array<unknown>;
|
156 |
|
157 | declare type RequiredOptions = Required<PrettyFormatOptions>;
|
158 |
|
159 | declare type Test = (arg0: any) => boolean;
|
160 |
|
161 | export declare type Theme = Options['theme'];
|
162 |
|
163 | export {};
|