import * as messages from '@cucumber/messages' ; import { Query } from '@cucumber/gherkin-utils' ; import IClock from './IClock' ; import HookTestStep from './HookTestStep' ; import { MakeErrorMessage } from './ErrorMessageGenerator' ; import IStopwatch from './IStopwatch' ; import { IHook , ITestStep } from './types' ; export default function makeHookTestStep ( pickle , hook , alwaysExecute , gherkinQuery , newId , clock , stopwatch , makeErrorMessage ) { const supportCodeExecutor = hook . match ( pickle ) ; if ( supportCodeExecutor !== null ) { const id = newId ( ) ; const sourceFrames = ( pickle . astNodeIds || [ ] ) . map ( ( astNodeId ) => `${ pickle . uri }:${ gherkinQuery . getLocation ( astNodeId ) . line }` ) ; return new HookTestStep ( id , hook . id , alwaysExecute , [ supportCodeExecutor ] , sourceFrames , clock , stopwatch , makeErrorMessage ) ; } }