(step, fn, callerInfo)
| 124 | |
| 125 | // New function that accepts caller info directly |
| 126 | const addStepWithCaller = async (step, fn, callerInfo) => { |
| 127 | const config = await getConfig() |
| 128 | const avoidDuplicateSteps = config.get('gherkin', {}).avoidDuplicateSteps || false |
| 129 | if (avoidDuplicateSteps && steps[step]) { |
| 130 | throw new Error(`Step '${step}' is already defined`) |
| 131 | } |
| 132 | steps[step] = fn |
| 133 | |
| 134 | // Use the caller info passed directly |
| 135 | fn.line = callerInfo |
| 136 | } |
| 137 | |
| 138 | const Given = createStepFunction('Given') |
| 139 | const When = createStepFunction('When') |
no test coverage detected