ParallelBufferedRunner

ParallelBufferedRunner

This Runner delegates tests runs to worker threads. Does not execute any
Runnables by itself!

Constructor

new ParallelBufferedRunner()

Source:

Methods

isParallelMode() → {true}

Source:

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}

Source:

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:
NameTypeAttributesDescription
valueboolean<optional>

If true, enable partial object linking, otherwise disable

Returns:
Type
Runner

run(callback, optsopt)

Source:

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:
NameTypeAttributesDescription
callbackfunction

Called with an exit code corresponding to
number of test failures.

optsObject<optional>

options

Properties
NameTypeDescription
filesArray:.<string:>

Files to run

optionsOptions

command-line options

workerReporter(path) → {Runner}

Source:

Configures an alternate reporter for worker processes to use. Subclasses
using worker processes should implement this.

Parameters:
NameTypeDescription
pathstring

Absolute path to alternate reporter for worker processes to use

Throws:

When in serial mode

Returns:
Type
Runner