Skip to content

Steps with escaped characters are not recognised properly #284

@TDL-EdgarsEglitis

Description

@TDL-EdgarsEglitis

👓 What did you see?

If a step definition requires escaping some characters, 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:

Feature: My Feature

  Scenario: Escaping Test
    Given I have (re)registered an account for "my@test.acc"

Create a step definition file:

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:
Image

Two backslashes:
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions