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 { configure, StreamReporter } from '@serenity-js/core';

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

 configure({
     crew: [
         new StreamReporter(fs.createWriteStream('./events.ndjson'))
     ],
 });
Registering StreamReporter using Protractor configuration
 // protractor.conf.js
 const { StreamReporter } = require('@serenity-js/core');

 exports.config = {
   framework:     'custom',
   frameworkPath: require.resolve('@serenity-js/protractor/adapter'),

   serenity: {
     crew: [
       new StreamReporter(process.stdout),
     ],
     // other Serenity/JS config
   },

   // other Protractor config
 };

Constructor Summary

Public Constructor
public

constructor(output: Writable, 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: Writable, stage: Stage) source

Params:

NameTypeAttributeDescription
output Writable

A Writable stream that should receive the output

stage Stage
  • optional

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

Listens:

DomainEvent