index.d.ts 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. */
  7. import chalk = require('chalk');
  8. import { DiffOptions as ImportDiffOptions } from 'jest-diff';
  9. declare type MatcherHintColor = (arg: string) => string;
  10. export 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. };
  20. export declare type DiffOptions = ImportDiffOptions;
  21. export declare const EXPECTED_COLOR: chalk.Chalk;
  22. export declare const RECEIVED_COLOR: chalk.Chalk;
  23. export declare const INVERTED_COLOR: chalk.Chalk;
  24. export declare const BOLD_WEIGHT: chalk.Chalk;
  25. export declare const DIM_COLOR: chalk.Chalk;
  26. export declare const SUGGEST_TO_CONTAIN_EQUAL: string;
  27. export declare const stringify: (object: unknown, maxDepth?: number) => string;
  28. export declare const highlightTrailingWhitespace: (text: string) => string;
  29. export declare const printReceived: (object: unknown) => string;
  30. export declare const printExpected: (value: unknown) => string;
  31. export declare const printWithType: (name: string, value: unknown, print: (value: unknown) => string) => string;
  32. export declare const ensureNoExpected: (expected: unknown, matcherName: string, options?: MatcherHintOptions | undefined) => void;
  33. /**
  34. * Ensures that `actual` is of type `number | bigint`
  35. */
  36. export declare const ensureActualIsNumber: (actual: unknown, matcherName: string, options?: MatcherHintOptions | undefined) => void;
  37. /**
  38. * Ensures that `expected` is of type `number | bigint`
  39. */
  40. export declare const ensureExpectedIsNumber: (expected: unknown, matcherName: string, options?: MatcherHintOptions | undefined) => void;
  41. /**
  42. * Ensures that `actual` & `expected` are of type `number | bigint`
  43. */
  44. export declare const ensureNumbers: (actual: unknown, expected: unknown, matcherName: string, options?: MatcherHintOptions | undefined) => void;
  45. export declare const ensureExpectedIsNonNegativeInteger: (expected: unknown, matcherName: string, options?: MatcherHintOptions | undefined) => void;
  46. export declare const printDiffOrStringify: (expected: unknown, received: unknown, expectedLabel: string, receivedLabel: string, expand: boolean) => string;
  47. export declare const diff: (a: unknown, b: unknown, options?: ImportDiffOptions | undefined) => string | null;
  48. export declare const pluralize: (word: string, count: number) => string;
  49. declare type PrintLabel = (string: string) => string;
  50. export declare const getLabelPrinter: (...strings: Array<string>) => PrintLabel;
  51. export declare const matcherErrorMessage: (hint: string, generic: string, specific?: string | undefined) => string;
  52. export declare const matcherHint: (matcherName: string, received?: string, expected?: string, options?: MatcherHintOptions) => string;
  53. export {};