Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

@serenity-js/core

Package Overview
Dependencies
Maintainers
1
Versions
374
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@serenity-js/core - npm Package Compare versions

Comparing version 3.7.2 to 3.8.0

16

CHANGELOG.md

@@ -6,2 +6,18 @@ # Change Log

# [3.8.0](https://github.com/serenity-js/serenity-js/compare/v3.7.2...v3.8.0) (2023-08-01)
### Bug Fixes
* **serenity-bdd:** corrected screenshot sort order in screenshot detail viewer ([7537622](https://github.com/serenity-js/serenity-js/commit/7537622d41193e3cf358a1b939c7422bcc3b207f)), closes [#1790](https://github.com/serenity-js/serenity-js/issues/1790)
### Features
* **core:** allow for easier debugging of Serenity/JS domain events using StreamReporter ([108677e](https://github.com/serenity-js/serenity-js/commit/108677e213423004127b6752301e73f66231030e)), closes [#1790](https://github.com/serenity-js/serenity-js/issues/1790)
## [3.7.2](https://github.com/serenity-js/serenity-js/compare/v3.7.1...v3.7.2) (2023-07-26)

@@ -8,0 +24,0 @@

2

lib/events/ActivityRelatedArtifactArchived.d.ts

@@ -13,5 +13,5 @@ import type { JSONObject } from 'tiny-types';

static fromJSON(o: JSONObject): ActivityRelatedArtifactArchived;
constructor(sceneId: CorrelationId, activityId: CorrelationId, name: Name, type: ArtifactType, path: Path, timestamp?: Timestamp);
constructor(sceneId: CorrelationId, activityId: CorrelationId, name: Name, type: ArtifactType, path: Path, artifactTimestamp: Timestamp, timestamp?: Timestamp);
toJSON(): JSONObject;
}
//# sourceMappingURL=ActivityRelatedArtifactArchived.d.ts.map

@@ -17,6 +17,6 @@ "use strict";

static fromJSON(o) {
return new ActivityRelatedArtifactArchived(model_1.CorrelationId.fromJSON(o.sceneId), model_1.CorrelationId.fromJSON(o.activityId), model_1.Name.fromJSON(o.name), model_1.Artifact.ofType(o.type), io_1.Path.fromJSON(o.path), screenplay_1.Timestamp.fromJSON(o.timestamp));
return new ActivityRelatedArtifactArchived(model_1.CorrelationId.fromJSON(o.sceneId), model_1.CorrelationId.fromJSON(o.activityId), model_1.Name.fromJSON(o.name), model_1.Artifact.ofType(o.type), io_1.Path.fromJSON(o.path), screenplay_1.Timestamp.fromJSON(o.artifactTimestamp), screenplay_1.Timestamp.fromJSON(o.timestamp));
}
constructor(sceneId, activityId, name, type, path, timestamp) {
super(sceneId, name, type, path, timestamp);
constructor(sceneId, activityId, name, type, path, artifactTimestamp, timestamp) {
super(sceneId, name, type, path, artifactTimestamp, timestamp);
this.activityId = activityId;

@@ -32,2 +32,3 @@ (0, tiny_types_1.ensure)('activityId', activityId, (0, tiny_types_1.isDefined)());

path: this.path.toJSON(),
artifactTimestamp: this.artifactTimestamp.toJSON(),
timestamp: this.timestamp.toJSON(),

@@ -34,0 +35,0 @@ };

@@ -15,6 +15,7 @@ import type { JSONObject } from 'tiny-types';

readonly path: Path;
readonly artifactTimestamp: Timestamp;
static fromJSON(o: JSONObject): ArtifactArchived;
constructor(sceneId: CorrelationId, name: Name, type: ArtifactType, path: Path, timestamp?: Timestamp);
constructor(sceneId: CorrelationId, name: Name, type: ArtifactType, path: Path, artifactTimestamp: Timestamp, timestamp?: Timestamp);
toJSON(): JSONObject;
}
//# sourceMappingURL=ArtifactArchived.d.ts.map

@@ -14,5 +14,5 @@ "use strict";

static fromJSON(o) {
return new ArtifactArchived(model_1.CorrelationId.fromJSON(o.sceneId), model_1.Name.fromJSON(o.name), model_1.Artifact.ofType(o.type), io_1.Path.fromJSON(o.path), screenplay_1.Timestamp.fromJSON(o.timestamp));
return new ArtifactArchived(model_1.CorrelationId.fromJSON(o.sceneId), model_1.Name.fromJSON(o.name), model_1.Artifact.ofType(o.type), io_1.Path.fromJSON(o.path), screenplay_1.Timestamp.fromJSON(o.artifactTimestamp), screenplay_1.Timestamp.fromJSON(o.timestamp));
}
constructor(sceneId, name, type, path, timestamp) {
constructor(sceneId, name, type, path, artifactTimestamp, timestamp) {
super(timestamp);

@@ -23,2 +23,3 @@ this.sceneId = sceneId;

this.path = path;
this.artifactTimestamp = artifactTimestamp;
(0, tiny_types_1.ensure)('sceneId', sceneId, (0, tiny_types_1.isDefined)());

@@ -28,2 +29,3 @@ (0, tiny_types_1.ensure)('name', name, (0, tiny_types_1.isDefined)());

(0, tiny_types_1.ensure)('path', path, (0, tiny_types_1.isDefined)());
(0, tiny_types_1.ensure)('artifactTimestamp', artifactTimestamp, (0, tiny_types_1.isDefined)());
}

@@ -35,2 +37,3 @@ toJSON() {

path: this.path.toJSON(),
createdAt: this.artifactTimestamp.toJSON(),
timestamp: this.timestamp.toJSON(),

@@ -37,0 +40,0 @@ };

@@ -6,3 +6,3 @@ import type { DomainEvent } from '../../../events';

/**
* Stores any {@apilink Artifact|artifacts} emitted via {@apilink ArtifactGenerated} events on the {@apilink FileSystem}
* Stores any {@apilink Artifact|artifacts} emitted via {@apilink ArtifactGenerated} events on the {@apilink FileSystem}.
*

@@ -22,8 +22,29 @@ * ## Registering `ArtifactArchiver` programmatically

*
* ## Registering `ArtifactArchiver` using Protractor configuration
* ## Using `ArtifactArchiver` with Playwright Test
*
* ```ts
* // playwright.config.ts
* import type { PlaywrightTestConfig } from '@serenity-js/playwright-test'
*
* const config: PlaywrightTestConfig = {
* testDir: './spec',
*
* reporter: [
* [ '@serenity-js/playwright-test', {
* crew: [
* '@serenity-js/serenity-bdd',
* [ '@serenity-js/core:ArtifactArchiver', { outputDirectory: 'target/site/serenity' } ],
* [ '@serenity-js/core:StreamReporter', { outputFile: 'target/events.ndjson' }]
* ]
* // other Serenity/JS config
* }]
* ],
* // other Playwright Test config
* }
* ```
*
* ## Using `ArtifactArchiver` with Protractor
*
* ```js
* // protractor.conf.js
* const { ArtifactArchiver } = require('@serenity-js/core')
*
* exports.config = {

@@ -35,3 +56,4 @@ * framework: 'custom',

* crew: [
* ArtifactArchiver.storingArtifactsAt('./target/site/serenity'),
* '@serenity-js/serenity-bdd',
* [ '@serenity-js/core:ArtifactArchiver', { outputDirectory: 'target/site/serenity' } ],
* ],

@@ -41,10 +63,9 @@ * // other Serenity/JS config

* // other Protractor config
* };
* }
* ```
*
* ## Registering `ArtifactArchiver` using WebdriverIO configuration
* ## Using `ArtifactArchiver` with WebdriverIO
*
* ```ts
* // wdio.conf.js
* import { ArtifactArchiver } from '@serenity-js/core'
* // wdio.conf.ts
* import { WebdriverIOConfig } from '@serenity-js/webdriverio'

@@ -54,16 +75,15 @@ *

*
* framework: '@serenity-js/webdriverio',
* framework: '@serenity-js/webdriverio',
*
* serenity: {
* crew: [
* ArtifactArchiver.storingArtifactsAt(`/target/site/serenity`),
* ]
* // other Serenity/JS config
* },
* // other WebdriverIO config
* serenity: {
* crew: [
* '@serenity-js/serenity-bdd',
* [ '@serenity-js/core:ArtifactArchiver', { outputDirectory: 'target/site/serenity' } ],
* ]
* // other Serenity/JS config
* },
* // other WebdriverIO config
* }
* ```
*
* [ '@serenity-js/core:ArtifactArchiver', { outputDirectory: 'target/site/serenity' } ],
*
* @group Stage

@@ -70,0 +90,0 @@ */

@@ -10,3 +10,3 @@ "use strict";

/**
* Stores any {@apilink Artifact|artifacts} emitted via {@apilink ArtifactGenerated} events on the {@apilink FileSystem}
* Stores any {@apilink Artifact|artifacts} emitted via {@apilink ArtifactGenerated} events on the {@apilink FileSystem}.
*

@@ -26,8 +26,29 @@ * ## Registering `ArtifactArchiver` programmatically

*
* ## Registering `ArtifactArchiver` using Protractor configuration
* ## Using `ArtifactArchiver` with Playwright Test
*
* ```ts
* // playwright.config.ts
* import type { PlaywrightTestConfig } from '@serenity-js/playwright-test'
*
* const config: PlaywrightTestConfig = {
* testDir: './spec',
*
* reporter: [
* [ '@serenity-js/playwright-test', {
* crew: [
* '@serenity-js/serenity-bdd',
* [ '@serenity-js/core:ArtifactArchiver', { outputDirectory: 'target/site/serenity' } ],
* [ '@serenity-js/core:StreamReporter', { outputFile: 'target/events.ndjson' }]
* ]
* // other Serenity/JS config
* }]
* ],
* // other Playwright Test config
* }
* ```
*
* ## Using `ArtifactArchiver` with Protractor
*
* ```js
* // protractor.conf.js
* const { ArtifactArchiver } = require('@serenity-js/core')
*
* exports.config = {

@@ -39,3 +60,4 @@ * framework: 'custom',

* crew: [
* ArtifactArchiver.storingArtifactsAt('./target/site/serenity'),
* '@serenity-js/serenity-bdd',
* [ '@serenity-js/core:ArtifactArchiver', { outputDirectory: 'target/site/serenity' } ],
* ],

@@ -45,10 +67,9 @@ * // other Serenity/JS config

* // other Protractor config
* };
* }
* ```
*
* ## Registering `ArtifactArchiver` using WebdriverIO configuration
* ## Using `ArtifactArchiver` with WebdriverIO
*
* ```ts
* // wdio.conf.js
* import { ArtifactArchiver } from '@serenity-js/core'
* // wdio.conf.ts
* import { WebdriverIOConfig } from '@serenity-js/webdriverio'

@@ -58,16 +79,15 @@ *

*
* framework: '@serenity-js/webdriverio',
* framework: '@serenity-js/webdriverio',
*
* serenity: {
* crew: [
* ArtifactArchiver.storingArtifactsAt(`/target/site/serenity`),
* ]
* // other Serenity/JS config
* },
* // other WebdriverIO config
* serenity: {
* crew: [
* '@serenity-js/serenity-bdd',
* [ '@serenity-js/core:ArtifactArchiver', { outputDirectory: 'target/site/serenity' } ],
* ]
* // other Serenity/JS config
* },
* // other WebdriverIO config
* }
* ```
*
* [ '@serenity-js/core:ArtifactArchiver', { outputDirectory: 'target/site/serenity' } ],
*
* @group Stage

@@ -157,6 +177,6 @@ */

if (event instanceof events_1.ActivityRelatedArtifactGenerated) {
this.stage.announce(new events_1.ActivityRelatedArtifactArchived(event.sceneId, event.activityId, event.name, event.artifact.constructor, relativePathToArtifact));
this.stage.announce(new events_1.ActivityRelatedArtifactArchived(event.sceneId, event.activityId, event.name, event.artifact.constructor, relativePathToArtifact, event.timestamp, this.stage.currentTime()));
}
else if (event instanceof events_1.ArtifactGenerated) {
this.stage.announce(new events_1.ArtifactArchived(event.sceneId, event.name, event.artifact.constructor, relativePathToArtifact));
this.stage.announce(new events_1.ArtifactArchived(event.sceneId, event.name, event.artifact.constructor, relativePathToArtifact, event.timestamp, this.stage.currentTime()));
}

@@ -163,0 +183,0 @@ };

@@ -8,3 +8,3 @@ /// <reference types="node" />

* Serialises all the {@apilink DomainEvent} objects it receives and streams
* them as [ndjson](http://ndjson.org/) to the output stream.
* them as [ndjson](http://ndjson.org/) to the output stream or file.
*

@@ -38,8 +38,27 @@ * Useful when debugging issues related to custom Serenity/JS test runner adapters.

*
* ## Registering `StreamReporter` using Protractor configuration
* ## Using `StreamReporter` with Playwright Test
*
* ```ts
* // playwright.config.ts
* import type { PlaywrightTestConfig } from '@serenity-js/playwright-test'
*
* const config: PlaywrightTestConfig = {
* testDir: './spec',
*
* reporter: [
* [ '@serenity-js/playwright-test', {
* crew: [
* [ '@serenity-js/core:StreamReporter', { outputFile: './events.ndjson' }]
* ]
* // other Serenity/JS config
* }]
* ],
* // other Playwright Test config
* }
* ```
*
* ## Using `StreamReporter` with Protractor
*
* ```js
* // protractor.conf.js
* const { StreamReporter } = require('@serenity-js/core');
*
* exports.config = {

@@ -51,3 +70,3 @@ * framework: 'custom',

* crew: [
* new StreamReporter(process.stdout),
* [ '@serenity-js/core:StreamReporter', { outputFile: './events.ndjson' }]
* ],

@@ -57,10 +76,9 @@ * // other Serenity/JS config

* // other Protractor config
* };
* }
* ```
*
* ## Registering `StreamReporter` using WebdriverIO configuration
* ## Using `StreamReporter` with WebdriverIO
*
* ```ts
* // wdio.conf.js
* import { StreamReporter } from '@serenity-js/core'
* // wdio.conf.ts
* import { WebdriverIOConfig } from '@serenity-js/webdriverio'

@@ -70,10 +88,10 @@ *

*
* framework: '@serenity-js/webdriverio',
* framework: '@serenity-js/webdriverio',
*
* serenity: {
* crew: [
* new StreamReporter(process.stdout),
* ]
* // other Serenity/JS config
* },
* serenity: {
* crew: [
* '@serenity-js/serenity-bdd',
* [ '@serenity-js/core:StreamReporter', { outputFile: './events.ndjson' }]
* ]
* // other Serenity/JS config
* },

@@ -90,2 +108,12 @@ * // other WebdriverIO config

/**
* Instantiates a `StreamReporter` outputting a stream of {@apilink DomainEvent|domain events}
* to an `outputFile` at the given location.
*
* @param config
*/
static fromJSON(config: {
outputFile: string;
cwd?: string;
}): StageCrewMember;
/**
* @param {stream~Writable} output

@@ -92,0 +120,0 @@ * A Writable stream that should receive the output

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.StreamReporter = void 0;
const tiny_types_1 = require("tiny-types");
const io_1 = require("../../../io");
/**
* Serialises all the {@apilink DomainEvent} objects it receives and streams
* them as [ndjson](http://ndjson.org/) to the output stream.
* them as [ndjson](http://ndjson.org/) to the output stream or file.
*

@@ -35,8 +37,27 @@ * Useful when debugging issues related to custom Serenity/JS test runner adapters.

*
* ## Registering `StreamReporter` using Protractor configuration
* ## Using `StreamReporter` with Playwright Test
*
* ```ts
* // playwright.config.ts
* import type { PlaywrightTestConfig } from '@serenity-js/playwright-test'
*
* const config: PlaywrightTestConfig = {
* testDir: './spec',
*
* reporter: [
* [ '@serenity-js/playwright-test', {
* crew: [
* [ '@serenity-js/core:StreamReporter', { outputFile: './events.ndjson' }]
* ]
* // other Serenity/JS config
* }]
* ],
* // other Playwright Test config
* }
* ```
*
* ## Using `StreamReporter` with Protractor
*
* ```js
* // protractor.conf.js
* const { StreamReporter } = require('@serenity-js/core');
*
* exports.config = {

@@ -48,3 +69,3 @@ * framework: 'custom',

* crew: [
* new StreamReporter(process.stdout),
* [ '@serenity-js/core:StreamReporter', { outputFile: './events.ndjson' }]
* ],

@@ -54,10 +75,9 @@ * // other Serenity/JS config

* // other Protractor config
* };
* }
* ```
*
* ## Registering `StreamReporter` using WebdriverIO configuration
* ## Using `StreamReporter` with WebdriverIO
*
* ```ts
* // wdio.conf.js
* import { StreamReporter } from '@serenity-js/core'
* // wdio.conf.ts
* import { WebdriverIOConfig } from '@serenity-js/webdriverio'

@@ -67,10 +87,10 @@ *

*
* framework: '@serenity-js/webdriverio',
* framework: '@serenity-js/webdriverio',
*
* serenity: {
* crew: [
* new StreamReporter(process.stdout),
* ]
* // other Serenity/JS config
* },
* serenity: {
* crew: [
* '@serenity-js/serenity-bdd',
* [ '@serenity-js/core:StreamReporter', { outputFile: './events.ndjson' }]
* ]
* // other Serenity/JS config
* },

@@ -85,2 +105,14 @@ * // other WebdriverIO config

/**
* Instantiates a `StreamReporter` outputting a stream of {@apilink DomainEvent|domain events}
* to an `outputFile` at the given location.
*
* @param config
*/
static fromJSON(config) {
const outputFile = (0, tiny_types_1.ensure)('outputFile', config?.outputFile, (0, tiny_types_1.isDefined)(), (0, tiny_types_1.isString)());
const cwd = config.cwd || process.cwd();
const fs = new io_1.FileSystem(io_1.Path.from(cwd));
return new StreamReporter(fs.createWriteStreamTo(io_1.Path.from(outputFile)));
}
/**
* @param {stream~Writable} output

@@ -87,0 +119,0 @@ * A Writable stream that should receive the output

{
"name": "@serenity-js/core",
"version": "3.7.2",
"version": "3.8.0",
"description": "Serenity/JS Screenplay, reporting engine and core interfaces.",

@@ -74,3 +74,3 @@ "author": {

},
"gitHead": "1803ef1287e21b4b6239f0800788483fe4e9d580"
"gitHead": "5a054cb7304cf0133c3370768fe03db67c197e59"
}

@@ -25,2 +25,3 @@ import type { JSONObject } from 'tiny-types';

Path.fromJSON(o.path as string),
Timestamp.fromJSON(o.artifactTimestamp as string),
Timestamp.fromJSON(o.timestamp as string),

@@ -36,5 +37,6 @@ );

path: Path,
artifactTimestamp: Timestamp,
timestamp?: Timestamp,
) {
super(sceneId, name, type, path, timestamp);
super(sceneId, name, type, path, artifactTimestamp, timestamp);
ensure('activityId', activityId, isDefined());

@@ -50,2 +52,3 @@ }

path: this.path.toJSON(),
artifactTimestamp: this.artifactTimestamp.toJSON(),
timestamp: this.timestamp.toJSON(),

@@ -52,0 +55,0 @@ };

@@ -20,2 +20,3 @@ import type { JSONObject } from 'tiny-types';

Path.fromJSON(o.path as string),
Timestamp.fromJSON(o.artifactTimestamp as string),
Timestamp.fromJSON(o.timestamp as string),

@@ -30,2 +31,3 @@ );

public readonly path: Path,
public readonly artifactTimestamp: Timestamp,
timestamp?: Timestamp,

@@ -39,2 +41,3 @@ ) {

ensure('path', path, isDefined());
ensure('artifactTimestamp', artifactTimestamp, isDefined());
}

@@ -47,2 +50,3 @@

path: this.path.toJSON(),
createdAt: this.artifactTimestamp.toJSON(),
timestamp: this.timestamp.toJSON(),

@@ -49,0 +53,0 @@ };

@@ -23,3 +23,3 @@ import type { WriteFileOptions } from 'fs';

/**
* Stores any {@apilink Artifact|artifacts} emitted via {@apilink ArtifactGenerated} events on the {@apilink FileSystem}
* Stores any {@apilink Artifact|artifacts} emitted via {@apilink ArtifactGenerated} events on the {@apilink FileSystem}.
*

@@ -39,8 +39,29 @@ * ## Registering `ArtifactArchiver` programmatically

*
* ## Registering `ArtifactArchiver` using Protractor configuration
* ## Using `ArtifactArchiver` with Playwright Test
*
* ```ts
* // playwright.config.ts
* import type { PlaywrightTestConfig } from '@serenity-js/playwright-test'
*
* const config: PlaywrightTestConfig = {
* testDir: './spec',
*
* reporter: [
* [ '@serenity-js/playwright-test', {
* crew: [
* '@serenity-js/serenity-bdd',
* [ '@serenity-js/core:ArtifactArchiver', { outputDirectory: 'target/site/serenity' } ],
* [ '@serenity-js/core:StreamReporter', { outputFile: 'target/events.ndjson' }]
* ]
* // other Serenity/JS config
* }]
* ],
* // other Playwright Test config
* }
* ```
*
* ## Using `ArtifactArchiver` with Protractor
*
* ```js
* // protractor.conf.js
* const { ArtifactArchiver } = require('@serenity-js/core')
*
* exports.config = {

@@ -52,3 +73,4 @@ * framework: 'custom',

* crew: [
* ArtifactArchiver.storingArtifactsAt('./target/site/serenity'),
* '@serenity-js/serenity-bdd',
* [ '@serenity-js/core:ArtifactArchiver', { outputDirectory: 'target/site/serenity' } ],
* ],

@@ -58,10 +80,9 @@ * // other Serenity/JS config

* // other Protractor config
* };
* }
* ```
*
* ## Registering `ArtifactArchiver` using WebdriverIO configuration
* ## Using `ArtifactArchiver` with WebdriverIO
*
* ```ts
* // wdio.conf.js
* import { ArtifactArchiver } from '@serenity-js/core'
* // wdio.conf.ts
* import { WebdriverIOConfig } from '@serenity-js/webdriverio'

@@ -71,16 +92,15 @@ *

*
* framework: '@serenity-js/webdriverio',
* framework: '@serenity-js/webdriverio',
*
* serenity: {
* crew: [
* ArtifactArchiver.storingArtifactsAt(`/target/site/serenity`),
* ]
* // other Serenity/JS config
* },
* // other WebdriverIO config
* serenity: {
* crew: [
* '@serenity-js/serenity-bdd',
* [ '@serenity-js/core:ArtifactArchiver', { outputDirectory: 'target/site/serenity' } ],
* ]
* // other Serenity/JS config
* },
* // other WebdriverIO config
* }
* ```
*
* [ '@serenity-js/core:ArtifactArchiver', { outputDirectory: 'target/site/serenity' } ],
*
* @group Stage

@@ -217,2 +237,4 @@ */

relativePathToArtifact,
event.timestamp,
this.stage.currentTime(),
));

@@ -225,2 +247,4 @@ } else if (event instanceof ArtifactGenerated) {

relativePathToArtifact,
event.timestamp,
this.stage.currentTime(),
));

@@ -227,0 +251,0 @@ }

import type { Writable } from 'stream';
import { ensure, isDefined, isString } from 'tiny-types';
import type { DomainEvent } from '../../../events';
import { FileSystem, Path } from '../../../io';
import type { Stage } from '../../Stage';

@@ -9,3 +11,3 @@ import type { StageCrewMember } from '../../StageCrewMember';

* Serialises all the {@apilink DomainEvent} objects it receives and streams
* them as [ndjson](http://ndjson.org/) to the output stream.
* them as [ndjson](http://ndjson.org/) to the output stream or file.
*

@@ -39,8 +41,27 @@ * Useful when debugging issues related to custom Serenity/JS test runner adapters.

*
* ## Registering `StreamReporter` using Protractor configuration
* ## Using `StreamReporter` with Playwright Test
*
* ```ts
* // playwright.config.ts
* import type { PlaywrightTestConfig } from '@serenity-js/playwright-test'
*
* const config: PlaywrightTestConfig = {
* testDir: './spec',
*
* reporter: [
* [ '@serenity-js/playwright-test', {
* crew: [
* [ '@serenity-js/core:StreamReporter', { outputFile: './events.ndjson' }]
* ]
* // other Serenity/JS config
* }]
* ],
* // other Playwright Test config
* }
* ```
*
* ## Using `StreamReporter` with Protractor
*
* ```js
* // protractor.conf.js
* const { StreamReporter } = require('@serenity-js/core');
*
* exports.config = {

@@ -52,3 +73,3 @@ * framework: 'custom',

* crew: [
* new StreamReporter(process.stdout),
* [ '@serenity-js/core:StreamReporter', { outputFile: './events.ndjson' }]
* ],

@@ -58,10 +79,9 @@ * // other Serenity/JS config

* // other Protractor config
* };
* }
* ```
*
* ## Registering `StreamReporter` using WebdriverIO configuration
* ## Using `StreamReporter` with WebdriverIO
*
* ```ts
* // wdio.conf.js
* import { StreamReporter } from '@serenity-js/core'
* // wdio.conf.ts
* import { WebdriverIOConfig } from '@serenity-js/webdriverio'

@@ -71,10 +91,10 @@ *

*
* framework: '@serenity-js/webdriverio',
* framework: '@serenity-js/webdriverio',
*
* serenity: {
* crew: [
* new StreamReporter(process.stdout),
* ]
* // other Serenity/JS config
* },
* serenity: {
* crew: [
* '@serenity-js/serenity-bdd',
* [ '@serenity-js/core:StreamReporter', { outputFile: './events.ndjson' }]
* ]
* // other Serenity/JS config
* },

@@ -90,2 +110,17 @@ * // other WebdriverIO config

/**
* Instantiates a `StreamReporter` outputting a stream of {@apilink DomainEvent|domain events}
* to an `outputFile` at the given location.
*
* @param config
*/
static fromJSON(config: { outputFile: string, cwd?: string }): StageCrewMember {
const outputFile = ensure('outputFile', config?.outputFile, isDefined(), isString());
const cwd = config.cwd || process.cwd();
const fs = new FileSystem(Path.from(cwd))
return new StreamReporter(fs.createWriteStreamTo(Path.from(outputFile)));
}
/**
* @param {stream~Writable} output

@@ -92,0 +127,0 @@ * A Writable stream that should receive the output

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc