gherkin: Scenario Outline variable subsitution not working for variables that contain special regex characters #1042
Labels
🐛 bug
Defect / Bug
language: javascript
library: gherkin
🧷 pinned
Tells Stalebot not to close this issue
It was suggested to me in cucumber/cucumber-js#1322 that I create an issue here instead.
Summary
We often use phrases like "is triggered" and "is not triggered". In scenario outlines. We phrase it as "the thing <is (not) triggered>". But when running the tests with cucumber-js, the step is not found because the variable is not replaced properly due to its parenthesis. I did not test any further but I reckon that all special regex characters will produce this problem.
Here an example:
Expected Behavior
The variable should be replaced properly. It works in the python
behave
package.Current Behavior
The variable does not get replaced.
Possible Solution
In the other issue we found out that https://github.com/cucumber/cucumber/blob/master/gherkin/javascript/src/pickles/compile.ts#L218 is probably the culprit. The variable name is used directly inside the
search
RegEx, but it should be be escaped before. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#EscapingYour Environment
Versions:
Ubuntu 18.04.4 LTS
cucumber-js: 6.0.5
node: v10.20.1
The text was updated successfully, but these errors were encountered: