Closed pr4bh4sh closed 3 years ago
The immediately suspicious thing is that the stack trace goes from cuke_modeler
to protobuf-cucumber
. Given that the versions of CukeModeler and Cucumber that you are using are from several years ago, that gem didn't even exist back then. I also don't see it in the lockfile of your sample project, so I'm curious what it is even doing in the runtime environment in the first place. Perhaps something will become more apparent when I try to recreate this locally.
I can run your recreation just fine on my machine and no issue is present.
After looking through the code, I can with reasonable confidence say that the problem is that your environment is mixing incompatible versions of various gems in the Cucumber tech stack. That is, you are running into https://github.com/cucumber/cucumber/issues/1063. The end result is that the wrong type of object is being given back to the cuke_modeler
gem when it uses Gherkin to parse the feature file. I say Gherkin instead of gherkin
or cucumber-gherkin
because I can't tell which gem (and any further transitive dependencies) is actually being invoked at runtime due to the linked issue.
To avoid this problem, your best bet is to either remove newer versions of Cucumber related gems from your runtime environment or to use use newer versions of cucumber-gherkin
and cuke_modeler
that are actually designed to handle the newer objects.
Thanks, it worked. I initially did uninstall cucumber but not all the deps.
For someone facing the same issue(or my future self)
gem uninstall $(gem list --no-versions | grep 'cucumber')
than bundle install
fixed the problem.
That makes sense. No newer version of cucumber
means no cucumber-gherkin
which, in turn, means no namespace conflicts with the gherkin
gem that cuke_modeler
thought it was actually using.
Glad to hear that it worked out.
I'm trying to run cuke_linter as part of overcommit's pre-commit hook. I'm partially successful in that. If I trigger overcommit manually everything goes as expected. However, when there are file change and overcommit is triggered by the commit action something goes wrong with parsing the feature file.
I'm not sure where does this issue belong here. However, from the stack trace, the error seems to be originating from cuke_linter's actions.
I've created https://github.com/pr4bh4sh/cuke-issue which reproduces the issue.
The steps to reproduce the issue are
clone the repo, install gem with bundler and create the overcommit sign.
git clone git@github.com:pr4bh4sh/cuke-issue.git && bundle install && overcommit -sign && overcommit --sign pre-commit
Run the overcommit with
overcommit -r
, the output would be something like✗ One or more pre-commit hooks failed