Stream Reporter

StreamReporter, available as part of the @serenity-js/core module, serialises DomainEvents it receives to JSON and sends them to a Writable stream.

This service is useful for debugging any custom extensions you create for Serenity/JS, or debugging the framework itself.

Installation

To install the module, run the following command in your computer terminal:

npm install --save-dev @serenity-js/core

Integration

StreamReporter listens to any DomainEvents emitted by Actors and Serenity/JS test runner adapters. It then streams them to a Writable stream, such as process.stdout, or one created via fs.createWriteStream(filename).

graph TB A(["fas:fa-users Actors"]) TRA(["fas:fa-plug Serenity/JS test runner adapter"]) S["Serenity"] SR[StreamReporter] T["fas:fa-terminal serialised events"] Log["fas:fa-file log.ndjson"] TRA -- notifies --> S A -- notify --> S subgraph "core" S -- notifies --> SR end SR -- prints --> T SR -- writes --> Log class A socket class TRA socket click A "/handbook/design/actors.html" click S "/modules/core" click SR "/modules/core/class/src/stage/crew/stream-reporter/StreamReporter.ts~StreamReporter.html"

Usage

To use StreamReporter, register it as one of the StageCrewMembers:

import { configure, StreamReporter } from '@serenity-js/core';
import * as fs from 'fs';

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

To learn more about the available configuration options, consult the StreamReporter API docs and its test suite.

You might also want to explore the example projects.

Love Serenity/JS? Spread the word on Twitter and LinkedIn!

Found a typo? You can fix it yourself or raise a ticket on GitHub.

If you'd like to help us bring more great tools and content to the Open-Source Community, become a GitHub Sponsor of Serenity/JS for as little as the cost of a cup of coffee.

Sponsor