Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.runtime = (matcher, implementation) => {
let expression;
if (matcher instanceof RegExp) {
expression = new RegularExpression(
matcher,
this.options.parameterTypeRegistry
);
} else {
expression = new CucumberExpression(
matcher,
this.options.parameterTypeRegistry
);
}
this.definitions.push({
implementation,
expression,
featureName: window.currentFeatureName || "___GLOBAL_EXECUTION___"
});
};
private registerStepDefinition(
expression: string | RegExp,
body: AnyBody
): void {
const sourceReference = getSourceReference(new Error().stack)
const expr =
typeof expression === 'string'
? new CucumberExpression(expression, this.parameterTypeRegistry)
: new RegularExpression(expression, this.parameterTypeRegistry)
const stepDefinition = new ExpressionStepDefinition(
this.newId(),
expr,
sourceReference,
body
)
this.stepDefinitions.push(stepDefinition)
}
({ code, line, options, pattern, uri }) => {
const expression =
typeof pattern === 'string'
? new CucumberExpression(pattern, this.parameterTypeRegistry)
: new RegularExpression(pattern, this.parameterTypeRegistry)
const wrappedCode = this.wrapCode({
code,
wrapperOptions: options.wrapperOptions,
})
return new StepDefinition({
code: wrappedCode,
expression,
id: this.newId(),
line,
options,
pattern,
unwrappedCode: code,
uri,
})
}
)