UNPKG

3.04 kBTypeScriptView Raw
1/**
2 * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
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 ImportDiffOptions } from 'jest-diff';
9declare type MatcherHintColor = (arg: string) => string;
10export declare type MatcherHintOptions = {
11 comment?: string;
12 expectedColor?: MatcherHintColor;
13 isDirectExpectCall?: boolean;
14 isNot?: boolean;
15 promise?: string;
16 receivedColor?: MatcherHintColor;
17 secondArgument?: string;
18 secondArgumentColor?: MatcherHintColor;
19};
20export declare type DiffOptions = ImportDiffOptions;
21export declare const EXPECTED_COLOR: chalk.Chalk;
22export declare const RECEIVED_COLOR: chalk.Chalk;
23export declare const INVERTED_COLOR: chalk.Chalk;
24export declare const BOLD_WEIGHT: chalk.Chalk;
25export declare const DIM_COLOR: chalk.Chalk;
26export declare const SUGGEST_TO_CONTAIN_EQUAL: string;
27export declare const stringify: (object: unknown, maxDepth?: number) => string;
28export declare const highlightTrailingWhitespace: (text: string) => string;
29export declare const printReceived: (object: unknown) => string;
30export declare const printExpected: (value: unknown) => string;
31export declare const printWithType: (name: string, value: unknown, print: (value: unknown) => string) => string;
32export declare const ensureNoExpected: (expected: unknown, matcherName: string, options?: MatcherHintOptions | undefined) => void;
33/**
34 * Ensures that `actual` is of type `number | bigint`
35 */
36export declare const ensureActualIsNumber: (actual: unknown, matcherName: string, options?: MatcherHintOptions | undefined) => void;
37/**
38 * Ensures that `expected` is of type `number | bigint`
39 */
40export declare const ensureExpectedIsNumber: (expected: unknown, matcherName: string, options?: MatcherHintOptions | undefined) => void;
41/**
42 * Ensures that `actual` & `expected` are of type `number | bigint`
43 */
44export declare const ensureNumbers: (actual: unknown, expected: unknown, matcherName: string, options?: MatcherHintOptions | undefined) => void;
45export declare const ensureExpectedIsNonNegativeInteger: (expected: unknown, matcherName: string, options?: MatcherHintOptions | undefined) => void;
46export declare const printDiffOrStringify: (expected: unknown, received: unknown, expectedLabel: string, receivedLabel: string, expand: boolean) => string;
47export declare const diff: (a: unknown, b: unknown, options?: ImportDiffOptions | undefined) => string | null;
48export declare const pluralize: (word: string, count: number) => string;
49declare type PrintLabel = (string: string) => string;
50export declare const getLabelPrinter: (...strings: Array<string>) => PrintLabel;
51export declare const matcherErrorMessage: (hint: string, generic: string, specific?: string | undefined) => string;
52export declare const matcherHint: (matcherName: string, received?: string, expected?: string, options?: MatcherHintOptions) => string;
53export {};