UNPKG

3.3 kBTypeScriptView Raw
1/**
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7import chalk = require('chalk');
8import {DiffOptions as DiffOptions_2} from 'jest-diff';
9
10export declare const BOLD_WEIGHT: chalk.Chalk;
11
12export declare const diff: (
13 a: unknown,
14 b: unknown,
15 options?: DiffOptions,
16) => string | null;
17
18export declare type DiffOptions = DiffOptions_2;
19
20export declare const DIM_COLOR: chalk.Chalk;
21
22/**
23 * Ensures that `actual` is of type `number | bigint`
24 */
25export declare const ensureActualIsNumber: (
26 actual: unknown,
27 matcherName: string,
28 options?: MatcherHintOptions,
29) => void;
30
31export declare const ensureExpectedIsNonNegativeInteger: (
32 expected: unknown,
33 matcherName: string,
34 options?: MatcherHintOptions,
35) => void;
36
37/**
38 * Ensures that `expected` is of type `number | bigint`
39 */
40export declare const ensureExpectedIsNumber: (
41 expected: unknown,
42 matcherName: string,
43 options?: MatcherHintOptions,
44) => void;
45
46export declare const ensureNoExpected: (
47 expected: unknown,
48 matcherName: string,
49 options?: MatcherHintOptions,
50) => void;
51
52/**
53 * Ensures that `actual` & `expected` are of type `number | bigint`
54 */
55export declare const ensureNumbers: (
56 actual: unknown,
57 expected: unknown,
58 matcherName: string,
59 options?: MatcherHintOptions,
60) => void;
61
62export declare const EXPECTED_COLOR: chalk.Chalk;
63
64export declare const getLabelPrinter: (...strings: Array<string>) => PrintLabel;
65
66export declare const highlightTrailingWhitespace: (text: string) => string;
67
68export declare const INVERTED_COLOR: chalk.Chalk;
69
70export declare const matcherErrorMessage: (
71 hint: string,
72 generic: string,
73 specific?: string,
74) => string;
75
76export declare const matcherHint: (
77 matcherName: string,
78 received?: string,
79 expected?: string,
80 options?: MatcherHintOptions,
81) => string;
82
83declare type MatcherHintColor = (arg: string) => string;
84
85export declare type MatcherHintOptions = {
86 comment?: string;
87 expectedColor?: MatcherHintColor;
88 isDirectExpectCall?: boolean;
89 isNot?: boolean;
90 promise?: string;
91 receivedColor?: MatcherHintColor;
92 secondArgument?: string;
93 secondArgumentColor?: MatcherHintColor;
94};
95
96export declare const pluralize: (word: string, count: number) => string;
97
98export declare const printDiffOrStringify: (
99 expected: unknown,
100 received: unknown,
101 expectedLabel: string,
102 receivedLabel: string,
103 expand: boolean,
104) => string;
105
106export declare const printExpected: (value: unknown) => string;
107
108declare type PrintLabel = (string: string) => string;
109
110export declare const printReceived: (object: unknown) => string;
111
112export declare function printWithType<T>(
113 name: string,
114 value: T,
115 print: (value: T) => string,
116): string;
117
118export declare const RECEIVED_COLOR: chalk.Chalk;
119
120export declare function replaceMatchedToAsymmetricMatcher(
121 replacedExpected: unknown,
122 replacedReceived: unknown,
123 expectedCycles: Array<unknown>,
124 receivedCycles: Array<unknown>,
125): {
126 replacedExpected: unknown;
127 replacedReceived: unknown;
128};
129
130export declare const stringify: (
131 object: unknown,
132 maxDepth?: number,
133 maxWidth?: number,
134) => string;
135
136export declare const SUGGEST_TO_CONTAIN_EQUAL: string;
137
138export {};