gherkin icon indicating copy to clipboard operation
gherkin copied to clipboard

Parsing error with comment only feature files

Open enkessler opened this issue 9 months ago • 6 comments

👓 What did you see?

I encountered a parsing error when running a Cucumber suite that included a feature file containing only a comment line.

unexpected end of file, expected: #Language, #TagLine, #FeatureLine, #Comment, #Empty (Cucumber::Core::Gherkin::ParseError)

✅ What did you expect to see?

I expected the file to parse cleanly and have no impact on the Cucumber execution (no errors, no pickles, etc.)

📦 Which tool/library version are you using?

OS: Windows Language: Ruby Cucumber version: various, as needed for whatever version of cucumber-gherkin that I was using Gherkin versions: 9-27. All versions of cucumber-gherkin are affected

🔬 How could we reproduce it?

Steps to reproduce the behavior:

  1. Have a feature file that only contains comments "my_great_idea.feature"
# Must write this idea down before I go to lunch and forget
  1. Attempt to run the feature cucumber my_great_idea.feature
  2. Get a parsing error unexpected end of file, expected: #Language, #TagLine, #FeatureLine, #Comment, #Empty (Cucumber::Core::Gherkin::ParseError)

📚 Any additional context?

Given that the parsing error explicitly lists #Comment tokens as a valid expectation at that point in the file, I am under the impression that the example feature is intended to be syntactically valid and that this is a bug in the parser.

This text was originally generated from a template, then edited by hand. You can modify the template here.

enkessler avatar Sep 30 '23 21:09 enkessler