import React from 'react' ; import * as messages from '@cucumber/messages' ; export class EnvelopesQuery { private envelopes : messages . Envelope [ ] = [ ] ; public update ( envelope ) { this . envelopes . push ( envelope ) ; } public find ( predicate ) { return this . envelopes . find ( predicate ) ; } public filter ( predicate ) { return this . envelopes . filter ( predicate ) ; } public getMeta ( ) { return this . find ( ( envelope ) => ! ! envelope . meta ) ?. meta ; } public getTestRunStarted ( ) { return this . find ( ( envelope ) => ! ! envelope . testRunStarted ) ?. testRunStarted ; } public getTestRunFinished ( ) { return this . find ( ( envelope ) => ! ! envelope . testRunFinished ) ?. testRunFinished ; } } export default React . createContext ( new EnvelopesQuery ( ) ) ;