BUPKIS
    Preparing search index...

    Interface AssertionFailure

    Object which may be returned from assertion function implementations to provide better failure reporting to the end-user.

    interface AssertionFailure {
        actual?: unknown;
        diff?: string;
        diffOptions?: DiffOptions;
        expected?: unknown;
        formatActual?: (value: unknown) => string;
        formatExpected?: (value: unknown) => string;
        message?: string;
    }
    Index

    Properties

    actual?: unknown

    The actual value or condition that was encountered

    diff?: string

    Pre-computed diff string. When provided, this bypasses jest-diff entirely and is used as-is in the error output. Takes precedence over formatActual, formatExpected, and diffOptions.

    return {
    actual: myDate,
    expected: otherDate,
    diff: ` Expected: ${formatDate(otherDate)}\n Actual: ${formatDate(myDate)}`,
    message: 'Dates are not on the same day',
    };
    diffOptions?: DiffOptions

    Override default jest-diff options. Only used when diff is not provided.

    jest-diff for available options

    expected?: unknown

    The expected value or condition that was not met

    formatActual?: (value: unknown) => string

    Custom formatter for the actual value in diff output. Only used when diff is not provided. The returned string is passed to jest-diff.

    Type Declaration

      • (value: unknown): string
      • Parameters

        • value: unknown

          The actual value to format

        Returns string

        String representation for diff display

    return {
    actual: sortedActual,
    expected: sortedExpected,
    formatActual: (v) => `[sorted] ${inspect(v)}`,
    formatExpected: (v) => `[sorted] ${inspect(v)}`,
    };
    formatExpected?: (value: unknown) => string

    Custom formatter for the expected value in diff output. Only used when diff is not provided. The returned string is passed to jest-diff.

    Type Declaration

      • (value: unknown): string
      • Parameters

        • value: unknown

          The expected value to format

        Returns string

        String representation for diff display

    message?: string

    A human-readable message describing the failure