- Since:
- 2.0.0
Methods
addReporter(reporterToAdd)
Add a custom reporter to the Jasmine environment.
Parameters:
Name | Type | Description |
---|---|---|
reporterToAdd |
Reporter | The reporter to be added. |
- Since:
- 2.0.0
- See:
allowRespy(allow)
Configures whether Jasmine should allow the same function to be spied on more than once during the execution of a spec. By default, spying on a function that is already a spy will cause an error.
Parameters:
Name | Type | Description |
---|---|---|
allow |
boolean | Whether to allow respying |
- Since:
- 2.5.0
clearReporters()
Clear all registered reporters
- Since:
- 2.5.2
configuration() → {Configuration}
Get the current configuration for your jasmine environment
- Since:
- 3.3.0
Returns:
- Type
- Configuration
configure(configuration)
Configure your jasmine environment
Parameters:
Name | Type | Description |
---|---|---|
configuration |
Configuration |
- Since:
- 3.3.0
execute(runnablesToRunopt, onCompleteopt) → {Promise.<undefined>}
Executes the specs.
If called with no parameters or with a falsy value as the first parameter,
all specs will be executed except those that are excluded by a
spec filter
or other mechanism. If the
first parameter is a list of spec/suite IDs, only those specs/suites will
be run.
Both parameters are optional, but a completion callback is only valid as the second parameter. To specify a completion callback but not a list of specs/suites to run, pass null or undefined as the first parameter.
execute should not be called more than once.
If the environment supports promises, execute will return a promise that
is resolved after the suite finishes executing. The promise will be
resolved (not rejected) as long as the suite runs to completion. Use a
Reporter
to determine whether or not the suite passed.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
runnablesToRun |
Array.<string> |
<optional> |
IDs of suites and/or specs to run |
onComplete |
function |
<optional> |
Function that will be called after all specs have run |
- Since:
- 2.0.0
Returns:
- Type
- Promise.<undefined>
hideDisabled()
- Since:
- 3.2.0
- Deprecated:
- Use the `hideDisabled` option with
Env#configure
- Use the `hideDisabled` option with
provideFallbackReporter(reporterToAdd)
Provide a fallback reporter if no other reporters have been specified.
Parameters:
Name | Type | Description |
---|---|---|
reporterToAdd |
Reporter | The reporter |
- Since:
- 2.5.0
- See:
randomizeTests(value)
Set whether to randomize test execution order
Parameters:
Name | Type | Description |
---|---|---|
value |
Boolean | Whether to randomize execution order |
- Since:
- 2.4.0
- Deprecated:
- Use the `random` option with
Env#configure
- Use the `random` option with
seed(value)
Set the random number seed for spec randomization
Parameters:
Name | Type | Description |
---|---|---|
value |
Number | The seed value |
- Since:
- 2.4.0
- Deprecated:
- Use the `seed` option with
Env#configure
- Use the `seed` option with
setSpecProperty(key, value)
Sets a user-defined property that will be provided to reporters as part of the properties field of SpecResult
Parameters:
Name | Type | Description |
---|---|---|
key |
String | The name of the property |
value |
* | The value of the property |
- Since:
- 3.6.0
setSuiteProperty(key, value)
Sets a user-defined property that will be provided to reporters as part of the properties field of SuiteResult
Parameters:
Name | Type | Description |
---|---|---|
key |
String | The name of the property |
value |
* | The value of the property |
- Since:
- 3.6.0
stopOnSpecFailure(value)
Set whether to stop suite execution when a spec fails
Parameters:
Name | Type | Description |
---|---|---|
value |
Boolean | Whether to stop suite execution when a spec fails |
- Since:
- 2.7.0
- Deprecated:
- Use the `stopOnSpecFailure` option with
Env#configure
- Use the `stopOnSpecFailure` option with
throwOnExpectationFailure(value)
Sets whether Jasmine should throw an Error when an expectation fails. This causes a spec to only have one expectation failure.
Parameters:
Name | Type | Description |
---|---|---|
value |
Boolean | Whether to throw when a expectation fails |
- Since:
- 2.3.0
- Deprecated:
- Use the `stopSpecOnExpectationFailure` option with
Env#configure
- Use the `stopSpecOnExpectationFailure` option with
topSuite() → {Suite}
Provides the root suite, through which all suites and specs can be accessed.
- Since:
- 2.0.0
Returns:
the root suite
- Type
- Suite