Socket
Socket
Sign inDemoInstall

@serenity-js/serenity-bdd

Package Overview
Dependencies
Maintainers
1
Versions
291
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@serenity-js/serenity-bdd - npm Package Compare versions

Comparing version 3.25.5 to 3.26.0

lib/stage/crew/serenity-bdd-reporter/processors/transformations/actorDetailsOf.d.ts

13

CHANGELOG.md

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

# [3.26.0](https://github.com/serenity-js/serenity-js/compare/v3.25.5...v3.26.0) (2024-08-27)
### Features
* **serenity-bdd:** include details of actors and their abilities in Serenity BDD reports ([df38495](https://github.com/serenity-js/serenity-js/commit/df384952345ff3e8614b8fe8c36cb0be21dc6a80))
* **serenity-bdd:** reporting actors' abilities can be toggled ([5bea8ff](https://github.com/serenity-js/serenity-js/commit/5bea8ffa8870a4a1128403e65b79ce852ca79abe))
* **serenity-bdd:** upgraded Serenity BDD CLI to 4.1.20 ([2cf3d53](https://github.com/serenity-js/serenity-js/commit/2cf3d53bced9052b8670a9cef4967ff53eb86e8f))
## [3.25.5](https://github.com/serenity-js/serenity-js/compare/v3.25.4...v3.25.5) (2024-08-18)

@@ -8,0 +21,0 @@

2

lib/cli/defaults.js

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

exports.defaults = {
artifact: 'net.serenity-bdd:serenity-cli:jar:4.1.6',
artifact: 'net.serenity-bdd:serenity-cli:jar:4.1.20',
repository: 'https://repo1.maven.org/maven2/',

@@ -23,0 +23,0 @@ cacheDir: 'node_modules/@serenity-js/serenity-bdd/cache',

import type { DomainEventQueue } from '@serenity-js/core';
import type { ActivityRelatedArtifactArchived, ActivityRelatedArtifactGenerated, BusinessRuleDetected, FeatureNarrativeDetected, SceneBackgroundDetected, SceneDescriptionDetected, SceneTagged, TestRunnerDetected } from '@serenity-js/core/lib/events';
import type { ActivityRelatedArtifactArchived, ActivityRelatedArtifactGenerated, ActorEntersStage, ActorStageExitStarts, BusinessRuleDetected, FeatureNarrativeDetected, SceneBackgroundDetected, SceneDescriptionDetected, SceneTagged, TestRunnerDetected } from '@serenity-js/core/lib/events';
import type { RequirementsHierarchy } from '@serenity-js/core/lib/io';
import type { SerenityBDD4ReportSchema } from '../serenity-bdd-report-schema';
import type { SerenityBDDReporterConfig } from '../SerenityBDDReporterConfig';
import type { SerenityBDDReportContext } from './SerenityBDDReportContext';

@@ -11,5 +12,8 @@ /**

protected readonly requirementsHierarchy: RequirementsHierarchy;
constructor(requirementsHierarchy: RequirementsHierarchy);
protected readonly reporterConfig: Required<SerenityBDDReporterConfig['reporter']>;
constructor(requirementsHierarchy: RequirementsHierarchy, reporterConfig: Required<SerenityBDDReporterConfig['reporter']>);
abstract supports(queue: DomainEventQueue): boolean;
abstract process(queue: DomainEventQueue): SerenityBDD4ReportSchema;
protected onActorEntersStage<Context extends SerenityBDDReportContext>(report: Context): (event: ActorEntersStage) => Context;
protected onActorStageExitStarts<Context extends SerenityBDDReportContext>(report: Context): (event: ActorStageExitStarts) => Context;
protected onFeatureNarrativeDetected<Context extends SerenityBDDReportContext>(report: Context): (event: FeatureNarrativeDetected) => Context;

@@ -16,0 +20,0 @@ protected onSceneBackgroundDetected<Context extends SerenityBDDReportContext>(report: Context): (event: SceneBackgroundDetected) => Context;

@@ -10,5 +10,15 @@ "use strict";

requirementsHierarchy;
constructor(requirementsHierarchy) {
reporterConfig;
constructor(requirementsHierarchy, reporterConfig) {
this.requirementsHierarchy = requirementsHierarchy;
this.reporterConfig = reporterConfig;
}
onActorEntersStage(report) {
return (event) => report
.with((0, transformations_1.actorDetailsOf)(event.actor, this.reporterConfig));
}
onActorStageExitStarts(report) {
return (event) => report
.with((0, transformations_1.actorDetailsOf)(event.actor, this.reporterConfig));
}
onFeatureNarrativeDetected(report) {

@@ -15,0 +25,0 @@ return (event) => report

@@ -5,2 +5,3 @@ import type { DomainEventQueues } from '@serenity-js/core';

import { Name } from '@serenity-js/core/lib/model';
import type { SerenityBDDReporterConfig } from '../SerenityBDDReporterConfig';
/**

@@ -12,3 +13,3 @@ * @package

private readonly sceneSequenceProcessor;
constructor(requirementsHierarchy: RequirementsHierarchy);
constructor(requirementsHierarchy: RequirementsHierarchy, reporterConfig: Required<SerenityBDDReporterConfig['reporter']>);
process(queues: DomainEventQueues): Array<{

@@ -15,0 +16,0 @@ artifact: Artifact;

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

sceneSequenceProcessor;
constructor(requirementsHierarchy) {
this.singleSceneProcessor = new single_scene_1.SingleSceneEventQueueProcessor(requirementsHierarchy);
this.sceneSequenceProcessor = new scene_sequence_1.SceneSequenceEventQueueProcessor(requirementsHierarchy);
constructor(requirementsHierarchy, reporterConfig) {
this.singleSceneProcessor = new single_scene_1.SingleSceneEventQueueProcessor(requirementsHierarchy, reporterConfig);
this.sceneSequenceProcessor = new scene_sequence_1.SceneSequenceEventQueueProcessor(requirementsHierarchy, reporterConfig);
}

@@ -19,0 +19,0 @@ // todo: move `name` to Artifact and return Artifact[]... and sceneId?

@@ -26,2 +26,4 @@ "use strict";

.when(events_1.SceneStarts, this.onSceneStarts(context))
.when(events_1.ActorEntersStage, this.onActorEntersStage(context))
.when(events_1.ActorStageExitStarts, this.onActorStageExitStarts(context))
.when(events_1.SceneTemplateDetected, this.onSceneTemplateDetected(context))

@@ -28,0 +30,0 @@ .when(events_1.SceneParametersDetected, this.onSceneParametersDetected(context))

@@ -0,1 +1,2 @@

import type { SerialisedActor } from '@serenity-js/core';
import type { RequirementsHierarchy } from '@serenity-js/core/lib/io';

@@ -12,2 +13,3 @@ import type { CorrelationId } from '@serenity-js/core/lib/model';

readonly steps: Map<string, LinkedTestStep>;
readonly actors: Map<string, SerialisedActor>;
currentActivityId: CorrelationId;

@@ -14,0 +16,0 @@ constructor(requirementsHierarchy: RequirementsHierarchy);

@@ -11,2 +11,3 @@ "use strict";

steps = new Map();
actors = new Map(); // sceneId -> actor
currentActivityId = undefined;

@@ -13,0 +14,0 @@ constructor(requirementsHierarchy) {

@@ -20,2 +20,4 @@ "use strict";

.when(events_1.SceneStarts, this.onSceneStarts(context))
.when(events_1.ActorEntersStage, this.onActorEntersStage(context))
.when(events_1.ActorStageExitStarts, this.onActorStageExitStarts(context))
.when(events_1.FeatureNarrativeDetected, this.onFeatureNarrativeDetected(context))

@@ -22,0 +24,0 @@ .when(events_1.SceneBackgroundDetected, this.onSceneBackgroundDetected(context))

export * from './activityFinished';
export * from './activityRelatedArtifact';
export * from './activityStarted';
export * from './actorDetailsOf';
export * from './archivedActivityRelatedArtifact';

@@ -5,0 +6,0 @@ export * from './backgroundOf';

@@ -20,2 +20,3 @@ "use strict";

__exportStar(require("./activityStarted"), exports);
__exportStar(require("./actorDetailsOf"), exports);
__exportStar(require("./archivedActivityRelatedArtifact"), exports);

@@ -22,0 +23,0 @@ __exportStar(require("./backgroundOf"), exports);

@@ -54,2 +54,3 @@ export interface SerenityBDD4ReportSchema {

can?: string[];
has?: string[];
}

@@ -56,0 +57,0 @@ export interface TagSchema {

import type { Stage, StageCrewMember, StageCrewMemberBuilder } from '@serenity-js/core';
import type { DomainEvent } from '@serenity-js/core/lib/events';
import { RequirementsHierarchy } from '@serenity-js/core/lib/io';
import { EventQueueProcessors } from './processors';
import type { SerenityBDDReporterConfig } from './SerenityBDDReporterConfig';

@@ -115,13 +115,12 @@ /**

export declare class SerenityBDDReporter implements StageCrewMember {
private readonly requirementsHierarchy;
private readonly processors;
private stage?;
private readonly eventQueues;
private readonly processors;
static fromJSON(config: SerenityBDDReporterConfig): StageCrewMemberBuilder<SerenityBDDReporter>;
/**
* @param {Path} requirementsHierarchy
* @param {EventQueueProcessors} processors
* @param {Stage} [stage]
* The stage this [`StageCrewMember`](https://serenity-js.org/api/core/interface/StageCrewMember/) should be assigned to
*/
constructor(requirementsHierarchy: RequirementsHierarchy, stage?: Stage);
constructor(processors: EventQueueProcessors, stage?: Stage);
/**

@@ -128,0 +127,0 @@ * @inheritDoc

@@ -120,6 +120,5 @@ "use strict";

class SerenityBDDReporter {
requirementsHierarchy;
processors;
stage;
eventQueues = new core_1.DomainEventQueues();
processors;
static fromJSON(config) {

@@ -129,10 +128,10 @@ return new SerenityBDDReporterBuilder(config);

/**
* @param {Path} requirementsHierarchy
* @param {EventQueueProcessors} processors
* @param {Stage} [stage]
* The stage this [`StageCrewMember`](https://serenity-js.org/api/core/interface/StageCrewMember/) should be assigned to
*/
constructor(requirementsHierarchy, stage) {
this.requirementsHierarchy = requirementsHierarchy;
constructor(processors, stage) {
this.processors = processors;
this.stage = stage;
this.processors = new processors_1.EventQueueProcessors((0, tiny_types_1.ensure)('requirementsHierarchy', requirementsHierarchy, (0, tiny_types_1.isDefined)()));
(0, tiny_types_1.ensure)('processors', processors, (0, tiny_types_1.isDefined)());
}

@@ -183,5 +182,11 @@ /**

const userDefinedSpecDirectory = this.config.specDirectory && io_1.Path.from(this.config.specDirectory);
return new SerenityBDDReporter(new io_1.RequirementsHierarchy(fileSystem, userDefinedSpecDirectory), stage);
const reporterConfig = {
includeAbilityDetails: this.config?.reporter?.includeAbilityDetails ?? true,
...this.config?.reporter,
};
const requirementsHierarchy = new io_1.RequirementsHierarchy(fileSystem, userDefinedSpecDirectory);
const processors = new processors_1.EventQueueProcessors(requirementsHierarchy, reporterConfig);
return new SerenityBDDReporter(processors, stage);
}
}
//# sourceMappingURL=SerenityBDDReporter.js.map

@@ -40,3 +40,10 @@ /**

specDirectory?: string;
reporter?: {
/**
* Whether to include the details of final state and configuration details of actors' abilities in Serenity BDD reports.
* Defaults to `true`.
*/
includeAbilityDetails?: boolean;
};
}
//# sourceMappingURL=SerenityBDDReporterConfig.d.ts.map
{
"name": "@serenity-js/serenity-bdd",
"version": "3.25.5",
"version": "3.26.0",
"description": "Serenity/JS reporting module that produces detailed Serenity BDD test reports and living documentation, enhancing transparency and traceability of test results",

@@ -49,7 +49,7 @@ "author": {

"dependencies": {
"@serenity-js/assertions": "3.25.5",
"@serenity-js/core": "3.25.5",
"@serenity-js/rest": "3.25.5",
"@serenity-js/assertions": "3.26.0",
"@serenity-js/core": "3.26.0",
"@serenity-js/rest": "3.26.0",
"ansi-regex": "5.0.1",
"axios": "1.7.4",
"axios": "1.7.5",
"chalk": "4.1.2",

@@ -64,3 +64,3 @@ "find-java-home": "2.0.0",

"@integration/testing-tools": "3.0.0",
"@types/chai": "4.3.17",
"@types/chai": "4.3.18",
"@types/mocha": "10.0.7",

@@ -76,3 +76,3 @@ "@types/progress": "2.0.7",

},
"gitHead": "9fffa14deab39e3443ebdf0502cd61ac1e39ee7c"
"gitHead": "bd5ea6b04d1fd1d9576a0fc28509f3f947365b35"
}

@@ -17,3 +17,3 @@ /**

export const defaults = {
artifact: 'net.serenity-bdd:serenity-cli:jar:4.1.6',
artifact: 'net.serenity-bdd:serenity-cli:jar:4.1.20',
repository: 'https://repo1.maven.org/maven2/',

@@ -20,0 +20,0 @@ cacheDir: 'node_modules/@serenity-js/serenity-bdd/cache',

@@ -5,2 +5,3 @@ import type { DomainEventQueue } from '@serenity-js/core';

ActivityRelatedArtifactGenerated,
ActorEntersStage, ActorStageExitStarts,
BusinessRuleDetected,

@@ -16,4 +17,15 @@ FeatureNarrativeDetected,

import type { SerenityBDD4ReportSchema } from '../serenity-bdd-report-schema';
import type { SerenityBDDReporterConfig } from '../SerenityBDDReporterConfig';
import type { SerenityBDDReportContext } from './SerenityBDDReportContext';
import { activityRelatedArtifact, archivedActivityRelatedArtifact, backgroundOf, businessRuleOf, descriptionOf, featureNarrativeOf, tagOf, testRunnerCalled } from './transformations';
import {
activityRelatedArtifact,
actorDetailsOf,
archivedActivityRelatedArtifact,
backgroundOf,
businessRuleOf,
descriptionOf,
featureNarrativeOf,
tagOf,
testRunnerCalled
} from './transformations';

@@ -24,3 +36,6 @@ /**

export abstract class EventQueueProcessor {
constructor(protected readonly requirementsHierarchy: RequirementsHierarchy) {
constructor(
protected readonly requirementsHierarchy: RequirementsHierarchy,
protected readonly reporterConfig: Required<SerenityBDDReporterConfig['reporter']>,
) {
}

@@ -31,2 +46,14 @@

protected onActorEntersStage<Context extends SerenityBDDReportContext>(report: Context) {
return (event: ActorEntersStage): Context =>
report
.with(actorDetailsOf(event.actor, this.reporterConfig));
}
protected onActorStageExitStarts<Context extends SerenityBDDReportContext>(report: Context) {
return (event: ActorStageExitStarts): Context =>
report
.with(actorDetailsOf(event.actor, this.reporterConfig));
}
protected onFeatureNarrativeDetected<Context extends SerenityBDDReportContext>(report: Context) {

@@ -33,0 +60,0 @@ return (event: FeatureNarrativeDetected): Context =>

@@ -9,2 +9,3 @@ import type { DomainEventQueues } from '@serenity-js/core';

import type { SerenityBDD4ReportSchema } from '../serenity-bdd-report-schema';
import type { SerenityBDDReporterConfig } from '../SerenityBDDReporterConfig';
import type { EventQueueProcessor } from './EventQueueProcessor';

@@ -22,5 +23,5 @@ import { SceneSequenceEventQueueProcessor } from './scene-sequence';

constructor(requirementsHierarchy: RequirementsHierarchy) {
this.singleSceneProcessor = new SingleSceneEventQueueProcessor(requirementsHierarchy);
this.sceneSequenceProcessor = new SceneSequenceEventQueueProcessor(requirementsHierarchy);
constructor(requirementsHierarchy: RequirementsHierarchy, reporterConfig: Required<SerenityBDDReporterConfig['reporter']>) {
this.singleSceneProcessor = new SingleSceneEventQueueProcessor(requirementsHierarchy, reporterConfig);
this.sceneSequenceProcessor = new SceneSequenceEventQueueProcessor(requirementsHierarchy, reporterConfig);
}

@@ -27,0 +28,0 @@

import type { DomainEventQueue } from '@serenity-js/core';
import type {
DomainEvent} from '@serenity-js/core/lib/events';
import type { DomainEvent } from '@serenity-js/core/lib/events';
import {

@@ -9,2 +8,4 @@ ActivityFinished,

ActivityStarts,
ActorEntersStage,
ActorStageExitStarts,
BusinessRuleDetected,

@@ -27,3 +28,10 @@ FeatureNarrativeDetected,

import type { SerenityBDDReportContext } from '../SerenityBDDReportContext';
import { activityFinished, activityStarted, executionFinishedAt, executionStartedAt, reportIdIncluding, scenarioDetailsOf } from '../transformations';
import {
activityFinished,
activityStarted,
executionFinishedAt,
executionStartedAt,
reportIdIncluding,
scenarioDetailsOf
} from '../transformations';
import { SceneSequenceReportContext } from './SceneSequenceReportContext';

@@ -50,2 +58,4 @@ import { scenarioOutlineOf, sceneSequenceOverallResult } from './transformations';

.when(SceneStarts, this.onSceneStarts(context))
.when(ActorEntersStage, this.onActorEntersStage(context))
.when(ActorStageExitStarts, this.onActorStageExitStarts(context))
.when(SceneTemplateDetected, this.onSceneTemplateDetected(context))

@@ -52,0 +62,0 @@ .when(SceneParametersDetected, this.onSceneParametersDetected(context))

@@ -0,1 +1,2 @@

import type { SerialisedActor } from '@serenity-js/core';
import type { RequirementsHierarchy } from '@serenity-js/core/lib/io';

@@ -14,2 +15,3 @@ import type { CorrelationId } from '@serenity-js/core/lib/model';

public readonly steps: Map<string, LinkedTestStep> = new Map();
public readonly actors: Map<string, SerialisedActor> = new Map(); // sceneId -> actor
public currentActivityId: CorrelationId = undefined;

@@ -16,0 +18,0 @@

import type { DomainEventQueue } from '@serenity-js/core';
import type {
DomainEvent} from '@serenity-js/core/lib/events';
import type { DomainEvent } from '@serenity-js/core/lib/events';
import {

@@ -9,2 +8,4 @@ ActivityFinished,

ActivityStarts,
ActorEntersStage,
ActorStageExitStarts,
BusinessRuleDetected,

@@ -24,3 +25,11 @@ FeatureNarrativeDetected,

import type { SerenityBDDReportContext } from '../SerenityBDDReportContext';
import { activityFinished, activityStarted, executionFinishedAt, executionFinishedWith, executionStartedAt, reportIdIncluding, scenarioDetailsOf } from '../transformations';
import {
activityFinished,
activityStarted,
executionFinishedAt,
executionFinishedWith,
executionStartedAt,
reportIdIncluding,
scenarioDetailsOf
} from '../transformations';
import { SingleSceneReportContext } from './SingleSceneReportContext';

@@ -42,2 +51,4 @@

.when(SceneStarts, this.onSceneStarts(context))
.when(ActorEntersStage, this.onActorEntersStage(context))
.when(ActorStageExitStarts, this.onActorStageExitStarts(context))
.when(FeatureNarrativeDetected, this.onFeatureNarrativeDetected(context))

@@ -44,0 +55,0 @@ .when(SceneBackgroundDetected, this.onSceneBackgroundDetected(context))

export * from './activityFinished';
export * from './activityRelatedArtifact';
export * from './activityStarted';
export * from './actorDetailsOf';
export * from './archivedActivityRelatedArtifact';

@@ -5,0 +6,0 @@ export * from './backgroundOf';

@@ -57,2 +57,3 @@ export interface SerenityBDD4ReportSchema /* extends JSONObject */ {

can?: string[];
has?: string[];
}

@@ -59,0 +60,0 @@

@@ -123,3 +123,2 @@ import type { Stage, StageCrewMember, StageCrewMemberBuilder, StageCrewMemberBuilderDependencies } from '@serenity-js/core';

private readonly eventQueues = new DomainEventQueues();
private readonly processors: EventQueueProcessors;

@@ -131,3 +130,3 @@ static fromJSON(config: SerenityBDDReporterConfig): StageCrewMemberBuilder<SerenityBDDReporter> {

/**
* @param {Path} requirementsHierarchy
* @param {EventQueueProcessors} processors
* @param {Stage} [stage]

@@ -137,6 +136,6 @@ * The stage this [`StageCrewMember`](https://serenity-js.org/api/core/interface/StageCrewMember/) should be assigned to

constructor(
private readonly requirementsHierarchy: RequirementsHierarchy,
private readonly processors: EventQueueProcessors,
private stage?: Stage,
) {
this.processors = new EventQueueProcessors(ensure('requirementsHierarchy', requirementsHierarchy, isDefined()));
ensure('processors', processors, isDefined());
}

@@ -213,8 +212,12 @@

const userDefinedSpecDirectory: Path | undefined = this.config.specDirectory && Path.from(this.config.specDirectory);
const reporterConfig: Required<SerenityBDDReporterConfig['reporter']> = {
includeAbilityDetails: this.config?.reporter?.includeAbilityDetails ?? true,
... this.config?.reporter,
};
return new SerenityBDDReporter(
new RequirementsHierarchy(fileSystem, userDefinedSpecDirectory),
stage,
);
const requirementsHierarchy = new RequirementsHierarchy(fileSystem, userDefinedSpecDirectory);
const processors = new EventQueueProcessors(requirementsHierarchy, reporterConfig);
return new SerenityBDDReporter(processors, stage);
}
}
}

@@ -41,2 +41,10 @@

specDirectory?: string;
reporter?: {
/**
* Whether to include the details of final state and configuration details of actors' abilities in Serenity BDD reports.
* Defaults to `true`.
*/
includeAbilityDetails?: boolean;
};
}

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