cucumber / cucumber-js

Cucumber for JavaScript
https://cucumber.io
MIT License
5.04k stars 1.09k forks source link

Line number of scenario is not considered when wild card used in feature file path #2369

Closed sumitsg004 closed 8 months ago

sumitsg004 commented 9 months ago

Hi Team, I am facing a simple issue when i try to execute cucumber feature files where I pass feature file with line number of scenarios in gradle command. When I use full path of feature file , I see different behavior than when i use wild card in path. Details below.

I have a feature file - AppInstaller.feature which has scenario1 (at line number 5) and scenario2 (at line number 32).

Path of AppInstaller.feature - "/Application/App-Install/App-Cycle/features/AppInstaller.feature"

Commands executed -

Command1 - ./gradlew runCucumberTests -Ptags="@yxz", -Pfeatures="/Application/App-Install/App-Cycle/features/AppInstaller.feature:5"

When above command is executed , only scenario at line number 5 is executed.

Command2 - ./gradlew runCucumberTests -Ptags="@yxz", -Pfeatures="/Application/**/AppInstaller.feature:5"

When wild card is used in file name, both scenarios are executed. But ideally only scenario at line number 5 should be executed.

Note - I have only 1 AppInstaller.feature in my repository.

Is this expected or issue that needs to be fixed ?

Please let me know if more details are required.

davidjgoss commented 9 months ago

It looks like you’re using cucumber-jvm - transferring the issue accordingly.

sumitsg004 commented 9 months ago

Hi David, I am using CucumberJs only to run playwright scripts

let runCucumber = [
  tags,
  parallelThreads,
  features, // Specify our feature files
  '--require-module ts-node/register', // Load TypeScript module
  '--require app-services/**/*.ts', // Load step definitions
  '--format progress-bar', // Load custom formatter
  '--format json:../build/results/cucumberPlaywright/json_results/cucumber-report.json'
].join(' ');
davidjgoss commented 9 months ago

cucumber-js is not invoked with Gradle. Do you have a custom task that is triggering cucumber-js in a new process?

Can you run cucumber-js with debug enabled so we can see the final resolved configuration? https://github.com/cucumber/cucumber-js/blob/main/docs/debugging.md

davidjgoss commented 8 months ago

This is expected behaviour - you can specify either a glob, or a full path with a line number.