index.d.mts 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import { Chalk } from "chalk";
  2. import { DiffOptions as DiffOptions$1 } from "jest-diff";
  3. //#region src/deepCyclicCopyReplaceable.d.ts
  4. /**
  5. * Copyright (c) Meta Platforms, Inc. and affiliates.
  6. *
  7. * This source code is licensed under the MIT license found in the
  8. * LICENSE file in the root directory of this source tree.
  9. */
  10. declare const SERIALIZABLE_PROPERTIES: unique symbol;
  11. //#endregion
  12. //#region src/index.d.ts
  13. type MatcherHintColor = (arg: string) => string;
  14. type MatcherHintOptions = {
  15. comment?: string;
  16. expectedColor?: MatcherHintColor;
  17. isDirectExpectCall?: boolean;
  18. isNot?: boolean;
  19. promise?: string;
  20. receivedColor?: MatcherHintColor;
  21. secondArgument?: string;
  22. secondArgumentColor?: MatcherHintColor;
  23. };
  24. type DiffOptions = DiffOptions$1;
  25. declare const EXPECTED_COLOR: Chalk;
  26. declare const RECEIVED_COLOR: Chalk;
  27. declare const INVERTED_COLOR: Chalk;
  28. declare const BOLD_WEIGHT: Chalk;
  29. declare const DIM_COLOR: Chalk;
  30. declare const SUGGEST_TO_CONTAIN_EQUAL: string;
  31. declare const stringify: (object: unknown, maxDepth?: number, maxWidth?: number) => string;
  32. declare const highlightTrailingWhitespace: (text: string) => string;
  33. declare const printReceived: (object: unknown) => string;
  34. declare const printExpected: (value: unknown) => string;
  35. declare function printWithType<T>(name: string, value: T, print: (value: T) => string): string;
  36. declare const ensureNoExpected: (expected: unknown, matcherName: string, options?: MatcherHintOptions) => void;
  37. /**
  38. * Ensures that `actual` is of type `number | bigint`
  39. */
  40. declare const ensureActualIsNumber: (actual: unknown, matcherName: string, options?: MatcherHintOptions) => void;
  41. /**
  42. * Ensures that `expected` is of type `number | bigint`
  43. */
  44. declare const ensureExpectedIsNumber: (expected: unknown, matcherName: string, options?: MatcherHintOptions) => void;
  45. /**
  46. * Ensures that `actual` & `expected` are of type `number | bigint`
  47. */
  48. declare const ensureNumbers: (actual: unknown, expected: unknown, matcherName: string, options?: MatcherHintOptions) => void;
  49. declare const ensureExpectedIsNonNegativeInteger: (expected: unknown, matcherName: string, options?: MatcherHintOptions) => void;
  50. declare const printDiffOrStringify: (expected: unknown, received: unknown, expectedLabel: string, receivedLabel: string, expand: boolean) => string;
  51. declare function replaceMatchedToAsymmetricMatcher(replacedExpected: unknown, replacedReceived: unknown, expectedCycles: Array<unknown>, receivedCycles: Array<unknown>): {
  52. replacedExpected: unknown;
  53. replacedReceived: unknown;
  54. };
  55. declare const diff: (a: unknown, b: unknown, options?: DiffOptions) => string | null;
  56. declare const pluralize: (word: string, count: number) => string;
  57. type PrintLabel = (string: string) => string;
  58. declare const getLabelPrinter: (...strings: Array<string>) => PrintLabel;
  59. declare const matcherErrorMessage: (hint: string, generic: string, specific?: string) => string;
  60. declare const matcherHint: (matcherName: string, received?: string, expected?: string, options?: MatcherHintOptions) => string;
  61. //#endregion
  62. export { BOLD_WEIGHT, DIM_COLOR, DiffOptions, EXPECTED_COLOR, INVERTED_COLOR, MatcherHintOptions, RECEIVED_COLOR, SERIALIZABLE_PROPERTIES, SUGGEST_TO_CONTAIN_EQUAL, diff, ensureActualIsNumber, ensureExpectedIsNonNegativeInteger, ensureExpectedIsNumber, ensureNoExpected, ensureNumbers, getLabelPrinter, highlightTrailingWhitespace, matcherErrorMessage, matcherHint, pluralize, printDiffOrStringify, printExpected, printReceived, printWithType, replaceMatchedToAsymmetricMatcher, stringify };