import { Outcome } from '@serenity-js/core/lib/model' ; import { Test } from 'mocha' ; package export class OutcomeRecorder { private recordedOutcomes : RecordedOutcome [ ] = [ ] ; public started ( test ) { this . recordedOutcomes . push ( { test } ) ; } public finished ( test , outcome ) { this . recordedOutcomes = this . recordedOutcomes . map ( recordedOutcome => recordedOutcome . test === test ? { ... recordedOutcome , outcome } : recordedOutcome ) ; } public outcomeOf ( test ) { return this . recordedOutcomes . find ( recordedOutcome => recordedOutcome . test === test ) ?. outcome ; } public erase ( test ) { this . recordedOutcomes = this . recordedOutcomes . filter ( recordedOutcome => recordedOutcome . test !== test ) ; } } interface RecordedOutcome { test : Test ; outcome ? : Outcome ; }