vscode icon indicating copy to clipboard operation
vscode copied to clipboard

Scoping for undefined steps within different step definition file paths

Open barrymichaeldoyle opened this issue 2 years ago • 1 comments

🤔 What's the problem you're trying to solve?

I'm having trouble with the linter when it comes to keeping the linting rules contained to a single folder, stepDefinitions with the exact same name in one feature folder will say that is is a valid step in a different feature.

It's frustrating because I want it to be scoped and this would help me catch errors earlier on in my development.

Currently I have this setup for the workspace:

"cucumber.features": [
    "apps/**/*/src/e2e/**/*.feature"
],
"cucumber.glue": [
    "apps/**/*/src/e2e/**/*.ts",
]

If I have a folder for view and a folder for create. I want my stepDefinitions to be scoped to those folders. E.g. view/view.feature might have the stepDefinition Given the "view" heading is displayed and create/create.feature might have the stepDefinition Given the "create" heading is displayed.

If I have the definition implemented in view/view.ts (Given("the {string} heading is displayed", ...)), this should satisfy the linter for the view.feature file and that alone, I EXPECT the create.feature stepDefinition to still be undefined, however it is picking up the file from the view.

✨ What's your proposed solution?

My pre-processor picks up this scoped way of working with the following config in locating step definitions:

path.resolve(process.cwd(), './src/e2e/[filepath]/**/*.{js,ts}'),
path.resolve(process.cwd(), './src/e2e/[filepath].{js,ts}'),

However I can't apply that [filepath] method to the vscode extension settings because it doesn't do anything.

⛏ Have you considered any alternatives or workarounds?

Right now I'm just dealing with it.

📚 Any additional context?

Maybe this is a feature that already exists, but it isn't documented anywhere.

barrymichaeldoyle avatar Mar 29 '23 08:03 barrymichaeldoyle

Having the same issue, can't find documentation for it anywhere

samwatts98 avatar Mar 30 '23 10:03 samwatts98