cucumber / cucumber/vscode

Scoping for undefined steps within different step definition file paths

Open
#150 1 comment 4 reactions 0 assignees View on GitHub
:zap: enhancement
Dominant language
TypeScript
Stars
88
Forks
33
PR merge metrics
No merged PRs in 30d

Description

### 🤔 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:

```json
"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:

```javascript
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.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing how the VS Code extension resolves the cucumber.features and cucumber.glue settings, then reproduce the example with separate view and create folders. Check whether the configured paths can scope step definitions by feature folder; done means a definition in view satisfies view.feature but leaves the matching create.feature step undefined.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
testing-qa, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.