import {StreamReporter} from '@serenity-js/core/lib/stage/crew/stream-reporter'
public class | source

StreamReporter

Serialises all the DomainEvent objects it receives and streams them as ndjson to the output stream.

Implements:

Examples:

Writing DomainEvents to standard output
import { serenity, StreamReporter } form '@serenity-js/core';

serenity.configure({
    crew: [ new StreamReporter(process.stdout) ],
});
Writing DomainEvents to a file
import { serenity, StreamReporter } form '@serenity-js/core';
import fs = require('fs');

serenity.configure({
    crew: [ new StreamReporter(fs.createWriteStream('./events.ndjson')) ],
});

Constructor Summary

Public Constructor
public

constructor(output: WriteStream, stage: Stage)

Method Summary

Public Methods
public

Creates a new instance of this StageCrewMember and assigns it to a given Stage.

public

notifyOf(event: DomainEvent): void

Handles DomainEvent objects emitted by the StageManager.

Public Constructors

public constructor(output: WriteStream, stage: Stage) source

Params:

NameTypeAttributeDescription
output WriteStream

A WriteStream that should receive the output

stage Stage
  • optional
  • default: null

The stage this StageCrewMember should be assigned to

Public Methods

public assignedTo(stage: Stage): StageCrewMember source

Creates a new instance of this StageCrewMember and assigns it to a given Stage.

Params:

NameTypeAttributeDescription
stage Stage

An instance of a Stage this StageCrewMember will be assigned to

Returns:

StageCrewMember

A new instance of this StageCrewMember

public notifyOf(event: DomainEvent): void source

Handles DomainEvent objects emitted by the StageManager.

Params:

NameTypeAttributeDescription
event DomainEvent

Returns:

void