new (require("pete/lib/RunOptions"))()
- Source:
Example
const RunOptions = require('pete/lib/RunOptions');
var options = new RunOptions();
Members
args :Array.<any>
- Description:
Array of arguments to pass to target function.
In case ofcallbacktype function, test run will provide one additional argument,
and pass it as the last one.
- Source:
- Default Value:
- []
Array of arguments to pass to target function.
In case of callback type function, test run will provide one additional argument,
and pass it as the last one.
Type:
- Array.<any>
Example
options.args = ['foo', 2]; // eslint-disable-line no-magic-numbers
exitOnError :boolean
- Description:
Set to
trueto stop all tests when there is an error.
- Source:
- Default Value:
- true
Set to true to stop all tests when there is an error.
Type:
- boolean
id :string
- Description:
ID of test.
- Source:
- See:
ID of test.
Type:
- string
limitCPUTime :number
- Description:
Limit total time (in milliseconds) that target function can take when run multiple times.
- Source:
- Default Value:
- Infinity
Limit total time (in milliseconds) that target function can take when run multiple times.
Type:
- number
limitRealTime :number
- Description:
Limit total time (in milliseconds) that test run can take.
- Source:
- Default Value:
- 3000
Limit total time (in milliseconds) that test run can take.
Type:
- number
limitSamples :number
- Description:
Limit how many times target function should be called when tested.
- Source:
- Default Value:
- Infinity
Limit how many times target function should be called when tested.
Type:
- number
name :string
- Description:
Name of test.
- Source:
Name of test.
Type:
- string
percentiles :Array.<number>
- Description:
List of percentiles that should be reported back.
- Source:
- Default Value:
- [50, 75, 90, 95, 97.5, 99, 99.95, 99.99]
List of percentiles that should be reported back.
Type:
- Array.<number>
reporters :Array.<string>
- Description:
List of reporters that should receive report data.
- Source:
- Default Value:
- []
List of reporters that should receive report data.
Type:
- Array.<string>
Example
options.reporters = ['tap?out=./report/test.tap', 'mico'];
runOnlyIf :string|Array.<string>
- Description:
ID of the only test that should be run in current process.
Empty string means "no filtering" - all tests will be run.
- Source:
- Default Value:
- ''
ID of the only test that should be run in current process.
Empty string means "no filtering" - all tests will be run.
Type:
- string | Array.<string>
runType :string
- Description:
Run type to use for the test.
To use custom runner, pass full path to JS file that exports factory function.
- Source:
- Default Value:
- 'auto'
- See:
-
- module:pete/lib/runs/auto.TYPES for supported type names.
Run type to use for the test.
To use custom runner, pass full path to JS file that exports factory function.
Type:
- string
warmupSamples :number
- Description:
Same as
limitSamples, only for "warmup" phase of test run.
Set to 0 to skip "warmup" phase.
- Source:
- Default Value:
- 3000
Same as limitSamples, only for "warmup" phase of test run.
Set to 0 to skip "warmup" phase.
Type:
- number
Methods
areInvalid() → {Error|null}
- Description:
Return
nullif options are valid and test can run.
- Source:
Returns:
- Type
- Error | null
helpText() → {string}
- Description:
Return a "help text", suitable to output in CLI environment.
- Source:
Returns:
- Type
- string
sanitize()
- Description:
Make sure that option values are of correct type, converting them when needed.
return {module:pete/lib/RunOptions}
this
- Source:
setFromArgv() → {module:pete/lib/RunOptions}
- Description:
Parse command line arguments and apply them as options.
- Source:
Returns:
this
setFromOptions(options) → {module:pete/lib/RunOptions}
- Description:
Pick properties from target options object if their name matches supported option.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
options |
object |
Returns:
this