Skip to content

Commit

Permalink
feat(console-reporter): test with reporter developement
Browse files Browse the repository at this point in the history
  • Loading branch information
In1th committed Feb 24, 2024
1 parent 30bda10 commit 85e2bf1
Show file tree
Hide file tree
Showing 4 changed files with 170 additions and 69 deletions.
Expand Up @@ -5,6 +5,7 @@ import type {
DomainEvent} from '@serenity-js/core/lib/events';
import {
ActivityRelatedArtifactGenerated,
GlobalExceptionEncountered,
InteractionFinished,
InteractionStarts,
SceneFinished,
Expand Down Expand Up @@ -267,6 +268,11 @@ export class ConsoleReporter implements ListensToDomainEvents {
this.printScene(event.sceneId);
}

if (event instanceof GlobalExceptionEncountered && event.outcome instanceof ProblemIndication) {
// this.globalError.recordIfNeeded(event.outcome.error);
this.printTestRunErrorOutcome(event.outcome);
}

if (event instanceof TestRunFinished) {
this.summary.recordTestRunFinishedAt(event.timestamp);

Expand Down
28 changes: 28 additions & 0 deletions packages/core/src/events/GlobalExceptionEncountered.ts
@@ -0,0 +1,28 @@
import type { JSONObject } from 'tiny-types';

import type { SerialisedOutcome } from '../model';
import { Outcome } from '../model';
import { Timestamp } from '../screenplay';
import { DomainEvent } from './DomainEvent';

/**
* Emitted when the last test in the test suite has finished running
* and it's time for any last-minute reporting activities to take place.
*
* @group Events
*/
export class GlobalExceptionEncountered extends DomainEvent {
static fromJSON(o: JSONObject): GlobalExceptionEncountered {
return new GlobalExceptionEncountered(
Outcome.fromJSON(o.error as SerialisedOutcome),
Timestamp.fromJSON(o.timestamp as string),
);
}

constructor(
public readonly error: Outcome,
timestamp?: Timestamp
) {
super(timestamp);
}
}
1 change: 1 addition & 0 deletions packages/core/src/events/index.ts
Expand Up @@ -12,6 +12,7 @@ export * from './BusinessRuleDetected';
export * from './DomainEvent';
export * from './EmitsDomainEvents';
export * from './FeatureNarrativeDetected';
export * from './GlobalExceptionEncountered';
export * from './InteractionFinished';
export * from './InteractionStarts';
export * from './RetryableSceneDetected';
Expand Down

0 comments on commit 85e2bf1

Please sign in to comment.