Methods
isParallelMode() → {true}
If this class is the Runner
in use, then this is going to return true
.
For use by reporters.
Returns:
- Type
- true
linkPartialObjects(valueopt) → {Runner}
Toggle partial object linking behavior; used for building object references from
unique ID's.
Example
// this reporter needs proper object references when run in parallel mode
class MyReporter() {
constructor(runner) {
this.runner.linkPartialObjects(true)
.on(EVENT_SUITE_BEGIN, suite => {
// this Suite may be the same object...
})
.on(EVENT_TEST_BEGIN, test => {
// ...as the `test.parent` property
});
}
}
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
value |
boolean |
<optional> |
If |
Returns:
- Type
- Runner
run(callback, opts)
Runs Mocha tests by creating a thread pool, then delegating work to the
worker threads.
Each worker receives one file, and as workers become available, they take a
file from the queue and run it. The worker thread execution is treated like
an RPC--it returns a Promise
containing serialized information about the
run. The information is processed as it's received, and emitted to a
Reporter, which is likely listening for these events.
Parameters:
Name | Type | Description |
---|---|---|
callback |
function | Called with an exit code corresponding to |
opts |
Object | Files to run and |
workerReporter(path) → {Runner}
Configures an alternate reporter for worker processes to use. Subclasses
using worker processes should implement this.
Parameters:
Name | Type | Description |
---|---|---|
path |
string | Absolute path to alternate reporter for worker processes to use |
Throws:
When in serial mode
Returns:
- Type
- Runner