Class TestResult

Represents the result of a test or group of tests.

Hierarchy

  • default
    • TestResult

Constructors

  • Parameters

    • test: any
    • Optionalparent: any
    • Optionaloptions: { only?: string | number | string[] | number[]; verbose?: boolean } = {}
      • Optionalonly?: string | number | string[] | number[]

        Only run a subset of tests If one or more numbers, or a string that begins with a number, it is a path to a test/group If one or more identifiers, it will only run tests with that id, regardless of nesting If mixed, it will follow the numbers as a path, then will not consume any more numbers until it finds the id.

      • Optionalverbose?: boolean

        Show all tests, not just failed ones

    Returns TestResult

Properties

actual: any
details: any[] = []
error: any
finished: Promise<any>
mapped: { actual: any; expect: any }
messages: { args: string[]; method: string }[]
options: { only?: string | number | string[] | number[]; verbose?: boolean }
parent: any
pass: any
stats: {} = {}
test: any
tests: any
timeTaken: number = 0
timeTakenAsync: number
STATS_AVAILABLE: string[] = ...

Accessors

Methods

  • Dispatches a synthetic event event to target and returns true if either event’s cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.

    MDN Reference

    Parameters

    • event: any

    Returns boolean

  • Evaluate whether the test passed or failed

    Returns { details: string[]; pass: any }

  • Evaluate whether a thrown error is as expected

    Returns { details: string[]; pass: any }

  • Evaluate whether the test took too long (for tests with time constraints)

    Returns { details: string[]; pass: any }

  • Get a summary of console messages intercepted during the test run.

    Parameters

    • Optionalo: { format?: "rich" | "plain" } = {}

      Options

      • Optionalformat?: "rich" | "plain"

        Format to use for output. Defaults to “rich”.

    Returns string

  • Get a string representation of the test result

    Parameters

    • Optionalo: any

    Returns string

  • Get a summary of the current status of the test

    Parameters

    • Optionalo: { format?: "rich" | "plain" } = {}

      Options

      • Optionalformat?: "rich" | "plain"

        Format to use for output. Defaults to “rich”

    Returns string

  • Returns a string representation of an object.

    Parameters

    • o: any

    Returns any[]