import { SupportCode } from '@cucumber/fake-cucumber' ; import * as messages from '@cucumber/messages' ; import IPredictableSupportCode from './IPredictableSupportCode' ; import PredictableHook from './PredictableHook' ; import PredictableStepDefinition from './PredictableStepDefinition' ; export default class PredictableSupportCode implements IPredictableSupportCode { constructor ( private readonly supportCode ) { } public addPredictableBeforeHook ( location , scenarioId , status , duration ? , stack ? ) { const id = this . supportCode . newId ( ) ; this . supportCode . registerBeforeHook ( new PredictableHook ( id , scenarioId , location , this . statusFromString ( status ) , duration || 0 , stack ) ) ; } public addPredictableAfterHook ( location , scenarioId , status , duration ? , stack ? ) { const id = this . supportCode . newId ( ) ; this . supportCode . registerAfterHook ( new PredictableHook ( id , scenarioId , location , this . statusFromString ( status ) , duration || 0 , stack ) ) ; } public addPredictableStepDefinition ( location , stepId , status , duration ? , stack ? ) { const id = this . supportCode . newId ( ) ; this . supportCode . registerStepDefinition ( new PredictableStepDefinition ( id , stepId , location , this . statusFromString ( status ) , duration || 0 , stack ) ) ; } private statusFromString ( status ) { return status . toUpperCase ( ) ; } }