Documentation Home
This page is for an older version of Jasmine (5.3).
The current stable version of Jasmine is: 5.4. You can also look at the docs for the next release: Edge

Interface: Configuration

Configuration

Members

alwaysListPendingSpecs :boolean|undefined

Whether the default reporter should list pending specs even if there are failures.

Type:
  • boolean | undefined
Default Value:
  • true

failSpecWithNoExpectations :boolean|undefined

Whether to fail specs that contain no expectations.

Type:
  • boolean | undefined
Default Value:
  • false

globalSetup :function|undefined

A function that will be called exactly once, even in parallel mode, before the test suite runs. This is intended to be used to initialize out-of-process state such as starting up an external service.

If the globalSetup function is async or otherwise returns a promise, Jasmine will wait up to Configuration#globalSetupTimeout milliseconds for it to finish before running specs. Callbacks are not supported.

globalSetup may be run in a different process from the specs. In-process side effects that it causes, including changes to the Jasmine environment, are not guaranteed to affect any or all specs. Use either beforeEach or beforeAll for in-process setup.

Type:
  • function | undefined

globalSetupTimeout :Number|undefined

The number of milliseconds to wait for an asynchronous Configuration#globalSetup to complete.

Type:
  • Number | undefined
Default Value:
  • 5000

globalTeardown :function|undefined

A function that will be called exactly once, even in parallel mode, after the test suite runs. This is intended to be used to clean up out-of-process state such as shutting down an external service.

If the globalTeardown function is async or otherwise returns a promise, Jasmine will wait up to Configuration#globalTeardownTimeout milliseconds for it to finish. Callbacks are not supported.

globalTeardown may be run in a different process from the specs. In-process side effects caused by specs, including changes to the Jasmine environment, are not guaranteed to be visible to globalTeardown. Use either afterEach or afterAll for in-process cleanup.

Type:
  • function | undefined

globalTeardownTimeout :Number|undefined

The number of milliseconds to wait for an asynchronous Configuration#globalTeardown to complete.

Type:
  • Number | undefined
Default Value:
  • 5000

helpers :Array.<string>|undefined

An array of helper file paths or globs that match helper files. Each path or glob will be evaluated relative to the spec directory. Helpers are loaded before specs.

Type:
  • Array.<string> | undefined

jsLoader :string|undefined

Specifies how to load files with names ending in .js. Valid values are "require" and "import". "import" should be safe in all cases, and is required if your project contains ES modules with filenames ending in .js.

Type:
  • string | undefined
Default Value:
  • "require"

random :boolean|undefined

Whether to run specs in a random order.

Type:
  • boolean | undefined
Default Value:
  • true

reporters :Array.<Reporter>|undefined

An array of reporters. Each object in the array will be passed to Jasmine#addReporter or ParallelRunner#addReporter.

This provides a middle ground between the --reporter= CLI option and full programmatic usage. Note that because reporters are objects with methods, this option can only be used in JavaScript config files (e.g spec/support/jasmine.js), not JSON.

Type:
  • Array.<Reporter> | undefined
See:

requires :Array.<string>|undefined

An array of module names to load via require() at the start of execution.

Type:
  • Array.<string> | undefined

spec_dir :string|undefined

The directory that spec files are contained in, relative to the project base directory.

Type:
  • string | undefined

spec_files :Array.<string>|undefined

An array of spec file paths or globs that match helper files. Each path or glob will be evaluated relative to the spec directory.

Type:
  • Array.<string> | undefined

stopOnSpecFailure :boolean|undefined

Whether to stop suite execution on the first spec failure.

Type:
  • boolean | undefined
Default Value:
  • false

stopSpecOnExpectationFailure :boolean|undefined

Whether to stop each spec on the first expectation failure.

Type:
  • boolean | undefined
Default Value:
  • false