| 53 | const parameterTypeRegistry = new ParameterTypeRegistry() |
| 54 | |
| 55 | const matchStep = step => { |
| 56 | for (const stepName in steps) { |
| 57 | if (stepName.indexOf('/') === 0) { |
| 58 | const regExpArr = stepName.match(/^\/(.*?)\/([gimy]*)$/) || [] |
| 59 | const res = step.match(new RegExp(regExpArr[1], regExpArr[2])) |
| 60 | if (res) { |
| 61 | const fn = steps[stepName] |
| 62 | fn.params = res.slice(1) |
| 63 | return fn |
| 64 | } |
| 65 | continue |
| 66 | } |
| 67 | const expression = new CucumberExpression(stepName, parameterTypeRegistry) |
| 68 | const res = expression.match(step) |
| 69 | if (res) { |
| 70 | const fn = steps[stepName] |
| 71 | fn.params = res.map(arg => arg.getValue(null)) |
| 72 | return fn |
| 73 | } |
| 74 | } |
| 75 | throw new Error(`No steps matching "${step.toString()}"`) |
| 76 | } |
| 77 | |
| 78 | const clearSteps = () => { |
| 79 | steps = {} |
no test coverage detected