简体   繁体   English

在Spacemacs中转到黄瓜步骤定义会引发异常:“无法加载此类文件-小黄瓜”

[英]Go to cucumber step definition in Spacemacs throws an exception: “Can not load such file — gherkin”

I have a ruby on rails project with feature specs written on cucumber and I am trying to set-up feature mode in my Spacemacs(Emacs) in order to be able to go to a cucumber step definition. 我有一个ruby on rails项目,其中的功能说明写在黄瓜上,我试图在我的Spacemacs(Emacs)中设置功能模式,以便能够进行黄瓜步骤定义。 In the project, we are using gherkin version 4.0, and I believe, the reason for my error could be that I need to instal another version of gherkin, that the Spacemacs feature mode could work properly. 在该项目中,我们使用的是gherkin 4.0版,我相信,导致我的错误的原因可能是我需要安装另一个版本的gherkin,Spacemacs功能模式才能正常工作。 Nevertheless, at the same time, I need to have 4.0 version also installed for the project. 不过,与此同时,我还需要为该项目安装4.0版本。

I have tried installing gherkin version 4.0 with bundler from Gemfile locally: bundle install and installing gherkin version 2.11.8 globally with gem install command: gem install gherkin -v 2.11.8 我尝试从本地Gemfile使用bundler bundle install gherkin版本4.0: bundle install并使用gem install命令在全局安装gherkin版本2.11.8: gem install gherkin -v 2.11.8

Unfortunately, didn't help :( 不幸的是,没有帮助:(

Stack: ruby, erb, rails, cucumber, rspec, spacemacs (emacs), 堆栈:红宝石,erb,rails,黄瓜,rspec,spacemacs(emacs),

I was suffering from the same issue and found that the lower bound on the gem version for Gherkin in feature-mode/support/find_step.rb is not sufficient. 我遇到了同样的问题,发现在feature-mode/support/find_step.rb的gem版本中, feature-mode/support/find_step.rb不够。 Newer versions of Gherkin seem to cause an exception to be thrown. 较新版本的Gherkin似乎会引发异常。 My hacky workaround is the following: 我的解决方法如下:

first install this version of gherkin 首先安装此版本的小黄瓜

gem install gherkin --version 2.11.8

then in spacemacs do the following command:

spc h d p feature-mode

open the package and navigate to support/find_step.rb

change
gem 'gherkin', '>= 2.11.8'
to
gem 'gherkin', '2.11.8'

save the file, and the feature-goto-step-definition function should work again

The package might no longer be maintained and needs a home. 该包裹可能不再维护,需要回家。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Cucumber功能可以将常量传递给步骤定义吗? - Can a Cucumber feature pass a constant to a step definition? 如何在步骤定义中访问Cucumber步骤名称? - How can I access a Cucumber step name in the step definition? 黄瓜步骤定义为Android - Cucumber Step definition for android 升级Cucumber 2.4-> 4.0失败:无法加载此类文件-Cucumber / Core / Gerkin / tag_expression(LoadError) - Upgrade Cucumber 2.4 -> 4.0 failed: cannot load such file — cucumber/core/gherkin/tag_expression (LoadError) 黄瓜步骤定义正则表达式排除 - Cucumber Step Definition Regex Exclude 黄瓜功能文件在命令行上运行,但不在Intellij中运行:无法加载步骤定义(未定义) - Cucumber feature file runs on the command line but not in Intellij: Can't load step definitions (undefined) 如何使步骤定义文件中的步骤失败,以便在黄瓜水豚环境中将场景自动标记为失败? - How to fail a step in step definition file so that scenario is automatically marked as failed in cucumber-capybara environment? LoadError:无法在运行命令rackup,ruby版本2.2.0和黄瓜2.1.0上加载此类文件— gherkin / formatter / json_formatter - LoadError: cannot load such file — gherkin/formatter/json_formatter , on running command rackup ,ruby version 2.2.0 and cucumber 2.1.0 黄瓜步骤定义为“鉴于我已登录” - Cucumber step definition for “Given that I'm logged in” 黄瓜-缓存step_definition.rb文件吗? - Cucumber - caching step_definition.rb files?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM