Steps with escaped characters are not recognised properly
- Dominant language
- TypeScript
- Stars
- 88
- Forks
- 33
- PR merge metrics
- No merged PRs in 30d
Description
### 👓 What did you see?
If a step definition requires [escaping some characters](https://github.com/cucumber/cucumber-expressions?tab=readme-ov-file#escaping), the current behavior is a little off (at least in JavaScript):
If I use one backslash character:
* In the feature file, the step is linked to its definition, and highlighting and go to step definition are working
* In the step definition file, ESLint complains about an unnecessary escape character
* Test fails with an error that the step is not defined
If I use two backslash characters:
* In the feature file, the step is not linked to its definition, and shows the undefined step warning
* In the step definition file, ESLint no longer complains
* Test passes
### ✅ What did you expect to see?
If using a single backslash character: undefined step warning
If using two backslash characters: highlighting and go to step definition
### 📦 Which tool/library version are you using?
* Node.js v22.17.0
* `@wdio/cucumber-framework` v9.19.1 (`@cucumber/cucumber` v10.9.0)
### 🔬 How could we reproduce it?
Create a feature file:
```gherkin
Feature: My Feature
Scenario: Escaping Test
Given I have (re)registered an account for "my@test.acc"
```
Create a step definition file:
```ts
import { Given } from "@wdio/cucumber-framework";
// import { Given } from "@cucumber/cucumber"; // this also works
Given("I have \\(re)registered an account for {string}", async (name: string) => {
console.log(name);
});
```
Use either one or two backslashes in the step definition file, and observe the behavior in the feature file.
### 📚 Any additional context?
One backslash:
Two backslashes:
Contributor guide
Assessment
This issue has not been assessed yet.