@types/jasmine

  • Version 5.1.4
  • Published
  • 57.8 kB
  • No dependencies
  • MIT license

Install

npm i @types/jasmine
yarn add @types/jasmine
pnpm add @types/jasmine

Overview

TypeScript definitions for jasmine

Index

Functions

function afterAll

afterAll: (action: jasmine.ImplementationCallback, timeout?: number) => void;
  • Run some shared teardown once after 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.

    Parameter action

    Function that contains the code to teardown your specs.

    Parameter timeout

    Custom timeout for an async afterAll

function afterEach

afterEach: (action: jasmine.ImplementationCallback, timeout?: number) => void;
  • Run some shared teardown after each of the specs in the describe in which it is called.

    Parameter action

    Function that contains the code to teardown your specs.

    Parameter timeout

    Custom timeout for an async afterEach.

function beforeAll

beforeAll: (action: jasmine.ImplementationCallback, timeout?: number) => void;
  • 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.

    Parameter action

    Function that contains the code to setup your specs.

    Parameter timeout

    Custom timeout for an async beforeAll.

function beforeEach

beforeEach: (action: jasmine.ImplementationCallback, timeout?: number) => void;
  • Run some shared setup before each of the specs in the describe in which it is called.

    Parameter action

    Function that contains the code to setup your specs.

    Parameter timeout

    Custom timeout for an async beforeEach.

function describe

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

    Parameter description

    Textual description of the group

    Parameter specDefinitions

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

function expect

expect: {
<T extends jasmine.Func>(spy: T | jasmine.Spy<T>): jasmine.FunctionMatchers<T>;
<T>(actual: ArrayLike<T>): jasmine.ArrayLikeMatchers<T>;
<T>(actual: T): jasmine.Matchers<T>;
(): jasmine.NothingMatcher;
};
  • Create an expectation for a spec. see https://tsetse.info/check-return-value

    Parameter spy

  • Create an expectation for a spec. see https://tsetse.info/check-return-value

    Parameter actual

  • Create an expectation for a spec. see https://tsetse.info/check-return-value

    Parameter actual

    Actual computed value to test expectations against.

  • Create an expectation for a spec.

function expectAsync

expectAsync: <T, U>(actual: T | PromiseLike<T>) => jasmine.AsyncMatchers<T, U>;
  • 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. see https://tsetse.info/check-return-value

    Parameter actual

    Actual computed value to test expectations against.

function fail

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

    Parameter e

    Reason for the failure

function fdescribe

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

    Parameter description

    Textual description of the group

    Parameter specDefinitions

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

function fit

fit: (
expectation: string,
assertion?: jasmine.ImplementationCallback,
timeout?: number
) => void;
  • A focused it. If suites or specs are focused, only those that are focused will be executed.

    Parameter expectation

    Textual description of what this spec is checking

    Parameter assertion

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

    Parameter timeout

    Custom timeout for an async spec.

function it

it: (
expectation: string,
assertion?: jasmine.ImplementationCallback,
timeout?: number
) => void;
  • 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.

    Parameter expectation

    Textual description of what this spec is checking

    Parameter assertion

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

    Parameter timeout

    Custom timeout for an async spec.

function 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.

    Parameter reason

    Reason the spec is pending.

function 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. 3.6.0

function 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. 3.6.0

function spyOn

spyOn: <T, K extends keyof T = keyof T>(
object: T,
method: T[K] extends Function ? K : never
) => jasmine.Spy<
T[K] extends jasmine.Func
? T[K]
: T[K] extends new (...args: infer A) => infer V
? (...args: A) => V
: never
>;
  • Install a spy onto an existing object.

    Parameter object

    The object upon which to install the Spy.

    Parameter method

    The name of the method to replace with a Spy.

function spyOnAllFunctions

spyOnAllFunctions: <T>(
object: T,
includeNonEnumerable?: boolean
) => jasmine.SpyObj<T>;
  • Installs spies on all writable and configurable properties of an object.

    Parameter object

    The object upon which to install the Spys.

    Parameter includeNonEnumerable

    Whether or not to add spies to non-enumerable properties.

function spyOnProperty

spyOnProperty: {
<T, K extends keyof T = keyof T>(
object: T,
property: K,
accessType?: 'get'
): jasmine.Spy<(this: T) => T[K]>;
<T, K extends keyof T = keyof T>(
object: T,
property: K,
accessType: 'set'
): jasmine.Spy<(this: T, value: T[K]) => void>;
};
  • Install a spy on a property installed with Object.defineProperty onto an existing object.

    Parameter object

    The object upon which to install the Spy.

    Parameter property

    The name of the property to replace with a Spy.

    Parameter accessType

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

function throwUnless

throwUnless: {
<T extends jasmine.Func>(spy: T | jasmine.Spy<T>): jasmine.FunctionMatchers<T>;
<T>(actual: ArrayLike<T>): jasmine.ArrayLikeMatchers<T>;
<T>(actual: T): jasmine.Matchers<T>;
};
  • Create an expectation for a spec and throw an error if it fails. see https://tsetse.info/check-return-value

    Parameter spy

  • Create an expectation for a spec and throw an error if it fails. see https://tsetse.info/check-return-value

    Parameter actual

    Actual computed value to test expectations against.

function throwUnlessAsync

throwUnlessAsync: <T, U>(
actual: T | PromiseLike<T>
) => jasmine.AsyncMatchers<T, U>;
  • Create an asynchronous expectation for a spec and throw an error if it fails.

    Parameter actual

    Actual computed value to test expectations against.

function xdescribe

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

    Parameter description

    Textual description of the group

    Parameter specDefinitions

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

function xit

xit: (
expectation: string,
assertion?: jasmine.ImplementationCallback,
timeout?: number
) => void;
  • A temporarily disabled it. The spec will report as pending and will not be executed.

    Parameter expectation

    Textual description of what this spec is checking

    Parameter assertion

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

    Parameter timeout

    Custom timeout for an async spec.

Namespaces

namespace jasmine

module 'jasmine' {}

    class jasmine

    class jasmine {}

      constructor

      constructor(options?: jasmine.JasmineOptions);

        property defaultReporterConfigured

        defaultReporterConfigured: boolean;
        • Deprecated

          Private property that may be changed or removed in the future

        property env

        env: jasmine.Env;

          property exitOnCompletion

          exitOnCompletion: boolean;

            property helperFiles

            helperFiles: string[];
            • Deprecated

              Private property that may be changed or removed in the future

            property jasmine

            jasmine: jasmine.Jasmine;

              property projectBaseDir

              projectBaseDir: string;
              • Deprecated

                Private property that may be changed or removed in the future

              property reporter

              reporter: jasmine.CustomReporter;
              • Deprecated

                Private property that may be changed or removed in the future

              property reportersCount

              reportersCount: number;
              • Deprecated

                Private property that may be changed or removed in the future

              property requires

              requires: string[];
              • Deprecated

                Private property that may be changed or removed in the future

              property showingColors

              showingColors: boolean;
              • Deprecated

                Private property that may be changed or removed in the future

              property specDir

              specDir: string;
              • Deprecated

                Private property that may be changed or removed in the future

              property specFiles

              specFiles: string[];
              • Deprecated

                Private property that may be changed or removed in the future

              method addHelperFile

              addHelperFile: (filePath: string) => void;

                method addMatchers

                addMatchers: (matchers: jasmine.CustomMatcherFactories) => void;

                  method addMatchingHelperFiles

                  addMatchingHelperFiles: (patterns: string[]) => void;

                    method addMatchingSpecFiles

                    addMatchingSpecFiles: (patterns: string[]) => void;

                      method addReporter

                      addReporter: (reporter: jasmine.CustomReporter) => void;
                      • Add a custom reporter to the Jasmine environment.

                      method addRequires

                      addRequires: (files: string[]) => void;
                      • Deprecated

                        Private method that may be changed or removed in the future

                      method addSpecFile

                      addSpecFile: (filePath: string) => void;
                      • Adds a spec file to the list that will be loaded when the suite is executed.

                      method clearReporters

                      clearReporters: () => void;
                      • Clears all registered reporters.

                      method configureDefaultReporter

                      configureDefaultReporter: (options: jasmine.DefaultReporterOptions) => void;
                      • Configure the default reporter.

                      method ConsoleReporter

                      static ConsoleReporter: () => any;

                        method coreVersion

                        coreVersion: () => string;
                        • The version of jasmine-core in use

                        method execute

                        execute: (
                        files?: string[],
                        filterString?: string
                        ) => Promise<jasmine.JasmineDoneInfo>;

                          method loadConfig

                          loadConfig: (config: jasmine.JasmineConfig) => void;

                            method loadConfigFile

                            loadConfigFile: (configFilePath?: string) => void;

                              method loadHelpers

                              loadHelpers: () => Promise<void>;
                              • Deprecated

                                Private method that may be changed or removed in the future

                              method loadRequires

                              loadRequires: () => void;
                              • Deprecated

                                Private method that may be changed or removed in the future

                              method loadSpecs

                              loadSpecs: () => Promise<void>;
                              • Deprecated

                                Private method that may be changed or removed in the future

                              method provideFallbackReporter

                              provideFallbackReporter: (reporter: jasmine.CustomReporter) => void;
                              • Provide a fallback reporter if no other reporters have been specified.

                              method randomizeTests

                              randomizeTests: (value: boolean) => void;
                              • Sets whether to randomize the order of specs.

                              method seed

                              seed: (value: number) => void;
                              • Sets the random seed.

                              method showColors

                              showColors: (value: boolean) => void;
                              • Sets whether to show colors in the console reporter.

                              method stopOnSpecFailure

                              stopOnSpecFailure: (value: boolean) => void;

                                method stopSpecOnExpectationFailure

                                stopSpecOnExpectationFailure: (value: boolean) => void;

                                  Package Files (1)

                                  Dependencies (0)

                                  No dependencies.

                                  Dev Dependencies (0)

                                  No dev dependencies.

                                  Peer Dependencies (0)

                                  No peer dependencies.

                                  Badge

                                  To add a badge like this onejsDocs.io badgeto 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/@types/jasmine.

                                  • Markdown
                                    [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/jasmine)
                                  • HTML
                                    <a href="https://www.jsdocs.io/package/@types/jasmine"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>