jest-matcher-utils
- Version 29.7.0
- Published
- 28.4 kB
- 4 dependencies
- MIT license
Install
npm i jest-matcher-utils
yarn add jest-matcher-utils
pnpm add jest-matcher-utils
Overview
A set of utility functions for expect and related packages
Index
Variables
Functions
- diff()
- ensureActualIsNumber()
- ensureExpectedIsNonNegativeInteger()
- ensureExpectedIsNumber()
- ensureNoExpected()
- ensureNumbers()
- getLabelPrinter()
- highlightTrailingWhitespace()
- matcherErrorMessage()
- matcherHint()
- pluralize()
- printDiffOrStringify()
- printExpected()
- printReceived()
- printWithType()
- replaceMatchedToAsymmetricMatcher()
- stringify()
Type Aliases
Variables
variable BOLD_WEIGHT
const BOLD_WEIGHT: chalk.Chalk;
variable DIM_COLOR
const DIM_COLOR: chalk.Chalk;
variable EXPECTED_COLOR
const EXPECTED_COLOR: chalk.Chalk;
variable INVERTED_COLOR
const INVERTED_COLOR: chalk.Chalk;
variable RECEIVED_COLOR
const RECEIVED_COLOR: chalk.Chalk;
variable SUGGEST_TO_CONTAIN_EQUAL
const SUGGEST_TO_CONTAIN_EQUAL: string;
Functions
function diff
diff: (a: unknown, b: unknown, options?: DiffOptions_2) => string | null;
function ensureActualIsNumber
ensureActualIsNumber: ( actual: unknown, matcherName: string, options?: MatcherHintOptions) => void;
Ensures that
actual
is of typenumber | bigint
function ensureExpectedIsNonNegativeInteger
ensureExpectedIsNonNegativeInteger: ( expected: unknown, matcherName: string, options?: MatcherHintOptions) => void;
function ensureExpectedIsNumber
ensureExpectedIsNumber: ( expected: unknown, matcherName: string, options?: MatcherHintOptions) => void;
Ensures that
expected
is of typenumber | bigint
function ensureNoExpected
ensureNoExpected: ( expected: unknown, matcherName: string, options?: MatcherHintOptions) => void;
function ensureNumbers
ensureNumbers: ( actual: unknown, expected: unknown, matcherName: string, options?: MatcherHintOptions) => void;
Ensures that
actual
&expected
are of typenumber | bigint
function getLabelPrinter
getLabelPrinter: (...strings: Array<string>) => PrintLabel;
function highlightTrailingWhitespace
highlightTrailingWhitespace: (text: string) => string;
function matcherErrorMessage
matcherErrorMessage: ( hint: string, generic: string, specific?: string) => string;
function matcherHint
matcherHint: ( matcherName: string, received?: string, expected?: string, options?: MatcherHintOptions) => string;
function pluralize
pluralize: (word: string, count: number) => string;
function printDiffOrStringify
printDiffOrStringify: ( expected: unknown, received: unknown, expectedLabel: string, receivedLabel: string, expand: boolean) => string;
function printExpected
printExpected: (value: unknown) => string;
function printReceived
printReceived: (object: unknown) => string;
function printWithType
printWithType: <T>( name: string, value: T, print: (value: T) => string) => string;
function replaceMatchedToAsymmetricMatcher
replaceMatchedToAsymmetricMatcher: ( replacedExpected: unknown, replacedReceived: unknown, expectedCycles: Array<unknown>, receivedCycles: Array<unknown>) => { replacedExpected: unknown; replacedReceived: unknown };
function stringify
stringify: (object: unknown, maxDepth?: number, maxWidth?: number) => string;
Type Aliases
type DiffOptions
type DiffOptions = DiffOptions_2;
type MatcherHintOptions
type MatcherHintOptions = { comment?: string; expectedColor?: MatcherHintColor; isDirectExpectCall?: boolean; isNot?: boolean; promise?: string; receivedColor?: MatcherHintColor; secondArgument?: string; secondArgumentColor?: MatcherHintColor;};
Package Files (1)
Dependencies (4)
Dev Dependencies (2)
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/jest-matcher-utils
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/jest-matcher-utils)
- HTML<a href="https://www.jsdocs.io/package/jest-matcher-utils"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 2458 ms. - Missing or incorrect documentation? Open an issue for this package.