ParallelBuffered

nodejs/reporters/parallel-buffered~ ParallelBuffered

The ParallelBuffered reporter is used by each worker process in "parallel"
mode, by default. Instead of reporting to STDOUT, etc., it retains a
list of events it receives and hands these off to the callback passed into
Mocha#run. That callback will then return the data to the main
process.

Constructor

new ParallelBuffered(runner)

Source:

Calls ParallelBuffered#createListeners

Parameters:
NameTypeDescription
runnerRunner

Members

events :Array:.<BufferedEvent:>

Source:

Retained list of events emitted from the Runner instance.

Type:
  • Array:.<BufferedEvent:>

listeners :Map:.<string:, EventListener:>

Source:

Map of Runner event names to listeners (for later teardown)

Type:
  • Map:.<string:, EventListener:>

Methods

createListener(eventName) → {EventListener}

Source:

Returns a new listener which saves event data in memory to
ParallelBuffered#events. Listeners are indexed by eventName and stored
in ParallelBuffered#listeners. This is a defensive measure, so that we
don't a) leak memory or b) remove other listeners that may not be
associated with this reporter.

Subclasses could override this behavior.

Parameters:
NameTypeDescription
eventNamestring

Name of event to create listener for

Returns:
Type
EventListener

createListeners(runner) → {ParallelBuffered}

Source:

Creates event listeners (using ParallelBuffered#createListener) for each
reporter-relevant event emitted by a Runner. This array is drained when
ParallelBuffered#done is called by Runner#run.

Subclasses could override this behavior.

Parameters:
NameTypeDescription
runnerRunner

Runner instance

Returns:
Type
ParallelBuffered

done(failures, callback)

Source:

Calls the Mocha#run callback (callback) with the test failure
count and the array of BufferedEvent objects. Resets the array.

This is called directly by Runner#run and should not be called by any other consumer.

Subclasses could override this.

Parameters:
NameTypeDescription
failuresnumber

Number of failed tests

callbackfunction

The callback passed to Mocha#run.