Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scoping for undefined steps within different step definition file paths #150

Open
barrymichaeldoyle opened this issue Mar 29, 2023 · 1 comment
Labels
⚡ enhancement Request for new functionality

Comments

@barrymichaeldoyle
Copy link

barrymichaeldoyle commented Mar 29, 2023

🤔 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.

@samwatts98
Copy link

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

@kieran-ryan kieran-ryan added the ⚡ enhancement Request for new functionality label Dec 3, 2023
@kieran-ryan kieran-ryan changed the title Can the cucumber linting stepDefinitions be scoped like my pre-processor scopes files? Scoping for undefined steps within different step definition file paths Jan 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⚡ enhancement Request for new functionality
Projects
None yet
Development

No branches or pull requests

3 participants