Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "node_modules/@types/jasmine/index.d"

Index

Type aliases

ImplementationCallback

ImplementationCallback: ImplementationCallback
deprecated

Use jasmine.ImplementationCallback instead.

Functions

afterAll

  • Run some shared teardown once before all of the specs in the describe are run. Note: Be careful, sharing the teardown from a afterAll makes it easy to accidentally leak state between your specs so that they erroneously pass or fail.

    Parameters

    • action: ImplementationCallback

      Function that contains the code to teardown your specs.

    • Optional timeout: number

      Custom timeout for an async afterAll

    Returns void

afterEach

  • Run some shared teardown after each of the specs in the describe in which it is called.

    Parameters

    • action: ImplementationCallback

      Function that contains the code to teardown your specs.

    • Optional timeout: number

      Custom timeout for an async afterEach.

    Returns void

beforeAll

  • Run some shared setup once before all of the specs in the describe are run. Note: Be careful, sharing the setup from a beforeAll makes it easy to accidentally leak state between your specs so that they erroneously pass or fail.

    Parameters

    • action: ImplementationCallback

      Function that contains the code to setup your specs.

    • Optional timeout: number

      Custom timeout for an async beforeAll.

    Returns void

beforeEach

  • Run some shared setup before each of the specs in the describe in which it is called.

    Parameters

    • action: ImplementationCallback

      Function that contains the code to setup your specs.

    • Optional timeout: number

      Custom timeout for an async beforeEach.

    Returns void

describe

  • describe(description: string, specDefinitions: function): void
  • Create a group of specs (often called a suite).

    Parameters

    • description: string

      Textual description of the group

    • specDefinitions: function

      Function for Jasmine to invoke that will define inner suites a specs

        • (): void
        • Returns void

    Returns void

expect

expectAsync

  • Create an asynchronous expectation for a spec. Note that the matchers that are provided by an asynchronous expectation all return promises which must be either returned from the spec or waited for using await in order for Jasmine to associate them with the correct spec.

    checkreturnvalue

    see https://tsetse.info/check-return-value

    Type parameters

    • T

    • U

    Parameters

    • actual: T | PromiseLike<T>

      Actual computed value to test expectations against.

    Returns AsyncMatchers<T, U>

fail

  • fail(e?: any): void
  • Explicitly mark a spec as failed.

    Parameters

    • Optional e: any

      Reason for the failure

    Returns void

fdescribe

  • fdescribe(description: string, specDefinitions: function): void
  • A focused describe. If suites or specs are focused, only those that are focused will be executed.

    Parameters

    • description: string

      Textual description of the group

    • specDefinitions: function

      Function for Jasmine to invoke that will define inner suites a specs

        • (): void
        • Returns void

    Returns void

fit

  • A focused it. If suites or specs are focused, only those that are focused will be executed.

    Parameters

    • expectation: string

      Textual description of what this spec is checking

    • Optional assertion: ImplementationCallback

      Function that contains the code of your test. If not provided the test will be pending.

    • Optional timeout: number

      Custom timeout for an async spec.

    Returns void

it

  • Define a single spec. A spec should contain one or more expectations that test the state of the code. A spec whose expectations all succeed will be passing and a spec with any failures will fail.

    Parameters

    • expectation: string

      Textual description of what this spec is checking

    • Optional assertion: ImplementationCallback

      Function that contains the code of your test. If not provided the test will be pending.

    • Optional timeout: number

      Custom timeout for an async spec.

    Returns void

pending

  • pending(reason?: string): void
  • Mark a spec as pending, expectation results will be ignored. If you call the function pending anywhere in the spec body, no matter the expectations, the spec will be marked pending.

    Parameters

    • Optional reason: string

      Reason the spec is pending.

    Returns void

runs

  • runs(asyncMethod: Function): void
  • Parameters

    • asyncMethod: Function

    Returns void

setSpecProperty

  • setSpecProperty(key: string, value: unknown): void
  • Sets a user-defined property that will be provided to reporters as part of the properties field of SpecResult.

    since

    3.6.0

    Parameters

    • key: string
    • value: unknown

    Returns void

setSuiteProperty

  • setSuiteProperty(key: string, value: unknown): void
  • Sets a user-defined property that will be provided to reporters as part of the properties field of SuiteResult.

    since

    3.6.0

    Parameters

    • key: string
    • value: unknown

    Returns void

spyOn

  • spyOn<T, K>(object: T, method: T[K] extends Function ? K : never): Spy<T[K] extends jasmine.Func ? T[K] : T[K] extends object ? function : never>
  • Install a spy onto an existing object.

    Type parameters

    • T

    • K: keyof T

    Parameters

    • object: T

      The object upon which to install the Spy.

    • method: T[K] extends Function ? K : never

      The name of the method to replace with a Spy.

    Returns Spy<T[K] extends jasmine.Func ? T[K] : T[K] extends object ? function : never>

spyOnAllFunctions

  • spyOnAllFunctions<T>(object: T): SpyObj<T>
  • Installs spies on all writable and configurable properties of an object.

    Type parameters

    • T

    Parameters

    • object: T

      The object upon which to install the Spys.

    Returns SpyObj<T>

spyOnProperty

  • spyOnProperty<T>(object: T, property: keyof T, accessType?: "get" | "set"): Spy
  • Install a spy on a property installed with Object.defineProperty onto an existing object.

    Type parameters

    • T

    Parameters

    • object: T

      The object upon which to install the Spy.

    • property: keyof T

      The name of the property to replace with a Spy.

    • Optional accessType: "get" | "set"

      The access type (get|set) of the property to Spy on.

    Returns Spy

waits

  • waits(timeout?: number): void
  • Parameters

    • Optional timeout: number

    Returns void

waitsFor

  • waitsFor(latchMethod: function, failureMessage?: string, timeout?: number): void
  • Parameters

    • latchMethod: function
        • (): boolean
        • Returns boolean

    • Optional failureMessage: string
    • Optional timeout: number

    Returns void

xdescribe

  • xdescribe(description: string, specDefinitions: function): void
  • A temporarily disabled describe. Specs within an xdescribe will be marked pending and not executed.

    Parameters

    • description: string

      Textual description of the group

    • specDefinitions: function

      Function for Jasmine to invoke that will define inner suites a specs

        • (): void
        • Returns void

    Returns void

xit

  • A temporarily disabled it. The spec will report as pending and will not be executed.

    Parameters

    • expectation: string

      Textual description of what this spec is checking

    • Optional assertion: ImplementationCallback

      Function that contains the code of your test. If not provided the test will be pending.

    • Optional timeout: number

      Custom timeout for an async spec.

    Returns void

Generated using TypeDoc