import { IStepDefinition , ISupportCodeExecutor } from '@cucumber/fake-cucumber' ; import * as messages from '@cucumber/messages' ; import { NilCodeExecutor } from './SupportCodeExecutor' ; export default class PredictableStepDefinition implements IStepDefinition { constructor ( public readonly id , private readonly stepId , private readonly location , public readonly status , public readonly duration , public readonly errorMessage ? ) { } match ( pickleStep ) { if ( pickleStep . astNodeIds . includes ( this . stepId ) ) { return new NilCodeExecutor ( this . id ) ; } return null ; } toMessage ( ) { const locationChunks = this . location . split ( ':' ) ; return { stepDefinition : { id : this . id , sourceReference : { uri : locationChunks [ 0 ] , location : { line : parseInt ( locationChunks [ 1 ] ) , } , } , pattern : { source : '[unknown regexp source]' , type : messages . StepDefinitionPatternType . REGULAR_EXPRESSION , } , } , } ; } }