index.d.ts 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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. */
  7. import chalk = require('chalk');
  8. import {DiffOptions as DiffOptions_2} from 'jest-diff';
  9. export declare const BOLD_WEIGHT: chalk.Chalk;
  10. export declare const diff: (
  11. a: unknown,
  12. b: unknown,
  13. options?: DiffOptions,
  14. ) => string | null;
  15. export declare type DiffOptions = DiffOptions_2;
  16. export declare const DIM_COLOR: chalk.Chalk;
  17. /**
  18. * Ensures that `actual` is of type `number | bigint`
  19. */
  20. export declare const ensureActualIsNumber: (
  21. actual: unknown,
  22. matcherName: string,
  23. options?: MatcherHintOptions,
  24. ) => void;
  25. export declare const ensureExpectedIsNonNegativeInteger: (
  26. expected: unknown,
  27. matcherName: string,
  28. options?: MatcherHintOptions,
  29. ) => void;
  30. /**
  31. * Ensures that `expected` is of type `number | bigint`
  32. */
  33. export declare const ensureExpectedIsNumber: (
  34. expected: unknown,
  35. matcherName: string,
  36. options?: MatcherHintOptions,
  37. ) => void;
  38. export declare const ensureNoExpected: (
  39. expected: unknown,
  40. matcherName: string,
  41. options?: MatcherHintOptions,
  42. ) => void;
  43. /**
  44. * Ensures that `actual` & `expected` are of type `number | bigint`
  45. */
  46. export declare const ensureNumbers: (
  47. actual: unknown,
  48. expected: unknown,
  49. matcherName: string,
  50. options?: MatcherHintOptions,
  51. ) => void;
  52. export declare const EXPECTED_COLOR: chalk.Chalk;
  53. export declare const getLabelPrinter: (...strings: Array<string>) => PrintLabel;
  54. export declare const highlightTrailingWhitespace: (text: string) => string;
  55. export declare const INVERTED_COLOR: chalk.Chalk;
  56. export declare const matcherErrorMessage: (
  57. hint: string,
  58. generic: string,
  59. specific?: string,
  60. ) => string;
  61. export declare const matcherHint: (
  62. matcherName: string,
  63. received?: string,
  64. expected?: string,
  65. options?: MatcherHintOptions,
  66. ) => string;
  67. declare type MatcherHintColor = (arg: string) => string;
  68. export declare type MatcherHintOptions = {
  69. comment?: string;
  70. expectedColor?: MatcherHintColor;
  71. isDirectExpectCall?: boolean;
  72. isNot?: boolean;
  73. promise?: string;
  74. receivedColor?: MatcherHintColor;
  75. secondArgument?: string;
  76. secondArgumentColor?: MatcherHintColor;
  77. };
  78. export declare const pluralize: (word: string, count: number) => string;
  79. export declare const printDiffOrStringify: (
  80. expected: unknown,
  81. received: unknown,
  82. expectedLabel: string,
  83. receivedLabel: string,
  84. expand: boolean,
  85. ) => string;
  86. export declare const printExpected: (value: unknown) => string;
  87. declare type PrintLabel = (string: string) => string;
  88. export declare const printReceived: (object: unknown) => string;
  89. export declare function printWithType<T>(
  90. name: string,
  91. value: T,
  92. print: (value: T) => string,
  93. ): string;
  94. export declare const RECEIVED_COLOR: chalk.Chalk;
  95. export declare function replaceMatchedToAsymmetricMatcher(
  96. replacedExpected: unknown,
  97. replacedReceived: unknown,
  98. expectedCycles: Array<unknown>,
  99. receivedCycles: Array<unknown>,
  100. ): {
  101. replacedExpected: unknown;
  102. replacedReceived: unknown;
  103. };
  104. export declare const stringify: (
  105. object: unknown,
  106. maxDepth?: number,
  107. maxWidth?: number,
  108. ) => string;
  109. export declare const SUGGEST_TO_CONTAIN_EQUAL: string;
  110. export {};