MCPcopy
hub / github.com/codeceptjs/CodeceptJS / addStepWithCaller

Function addStepWithCaller

lib/mocha/bdd.js:126–136  ·  view source on GitHub ↗
(step, fn, callerInfo)

Source from the content-addressed store, hash-verified

124
125// New function that accepts caller info directly
126const 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
138const Given = createStepFunction('Given')
139const When = createStepFunction('When')

Callers 1

createStepFunctionFunction · 0.85

Calls 2

getMethod · 0.80
getConfigFunction · 0.70

Tested by

no test coverage detected