Skip to main content

externalStreamReporter

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

Useful when debugging issues related to custom Serenity/JS test runner adapters.

Registering Stream Reporter programmatically

import { configure, StreamReporter } from '@serenity-js/core'

configure({
crew: [
new StreamReporter(process.stdout)
],
})

Writing Domain Events to a file

import { configure, StreamReporter } from '@serenity-js/core'
import fs = require('fs')

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

Using Stream Reporter with Playwright Test

// playwright.config.ts
import type { PlaywrightTestConfig } from '@serenity-js/playwright-test'

const config: PlaywrightTestConfig = {

reporter: [
[ '@serenity-js/playwright-test', {
crew: [
[ '@serenity-js/core:StreamReporter', { outputFile: './events.ndjson' } ]
]
// other Serenity/JS config
}]
],
// other Playwright Test config
}

Using Stream Reporter with WebdriverIO

// wdio.conf.ts
import { WebdriverIOConfig } from '@serenity-js/webdriverio'

export const config: WebdriverIOConfig = {

framework: '@serenity-js/webdriverio',

serenity: {
crew: [
'@serenity-js/serenity-bdd',
[ '@serenity-js/core:StreamReporter', { outputFile: './events.ndjson' }]
]
// other Serenity/JS config
},
// other WebdriverIO config
}

Using Stream Reporter with Protractor

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

serenity: {
crew: [
[ '@serenity-js/core:StreamReporter', { outputFile: './events.ndjson' }]
],
// other Serenity/JS config
},
// other Protractor config
}

Implements

Index

Constructors

externalconstructor

  • Parameters

    • externaloutput: Writable = process.stdout

      A Writable stream that should receive the output

    • externaloptionalstage: Stage

      The stage this StageCrewMember should be assigned to

    Returns StreamReporter

Methods

staticexternalfromJSON

  • Instantiates a StreamReporter outputting a stream of Serenity/JS domain events to an outputFile at the given location.


    Parameters

    • externalconfig: { outputFile: string; cwd?: string }
      • externaloutputFile: string
      • externaloptionalcwd: string

    Returns StageCrewMember

externalassignedTo

externalnotifyOf