gherlint / gherlint-vscode

GherLint VSCode extension
MIT License
5 stars 1 forks source link

rule: no_undefined_steps #22

Open kiranparajuli589 opened 2 years ago

kiranparajuli589 commented 2 years ago

for every javascript test framework supporting gherkin-cucumber integration, the step definition part is lagvag same.

like the dry run in nightwatch v2, we can detect the undefined steps using the power of gherlint.

is it a favorable rule for gherlint? 🤔

phil-davis commented 2 years ago

The linter would have to be made aware of the step-implementation location and language. For frameworks that are also written in JS, it should be easy enough for the linter to see if it can find a matching step. For other languages (for example, Behat implemented in PHP), the linter will have to search the PHP code for tags like @Given @When @Then in comments.

Maybe the text after the tags will have similar formats in every (most) implementations - a regex to match, or some plain text with a few simple ways to mention variables and alternative words.

So the linter just needs to understand what a comment line looks like in each language, find the @Given @When @Then tags in the comments, and make sure that there is exactly one step implementation that matches.

saw-jan commented 2 years ago

IMHO, the gherkin language linter should not worry about the step implementation (which will be in many different languages). The better option to implement things like this will be editor plugins or extensions such as our gherlint-vscode.

kiranparajuli589 commented 2 years ago

hmm, sounds nice. should I transfer this issue to gherlint-vscode or close this here? @saw-jan