import { DomainEvent } from '@serenity-js/core/lib/events' ; import { Stage , StageCrewMember } from '@serenity-js/core/lib/stage' ; import { JSONObject } from 'tiny-types' ; import { DTO } from './DTO' ; export class ChildProcessReporter implements StageCrewMember { constructor ( private readonly stage = null ) { } assignedTo ( stage ) { return new ChildProcessReporter ( stage ) ; } notifyOf ( event ) { process . send ( this . serialised ( event ) ) ; } private serialised ( event ) { return ( { type : event . constructor . name , value : event . toJSON ( ) as JSONObject , } ) ; } }