Cucumber/JRuby-未初始化常量语法::Ruby::设置错误创建格式化程序:html(NameError)

Cucumber/JRuby-未初始化常量语法::Ruby::设置错误创建格式化程序:html(NameError),cucumber,jruby,formatter,uninitialized-constant,Cucumber,Jruby,Formatter,Uninitialized Constant,我使用的是JRUBY/Cucumber/Watir框架,我有一个特定的features文件夹,每当我尝试使用内置HTML格式化程序时,它都会不断抛出此错误: uninitialized constant Syntax::Ruby::Set Error creating formatter: html (NameError) org/jruby/RubyModule.java:2690:in `const_missing' /Users/Casey.Guerrero

我使用的是JRUBY/Cucumber/Watir框架,我有一个特定的features文件夹,每当我尝试使用内置HTML格式化程序时,它都会不断抛出此错误:

    uninitialized constant Syntax::Ruby::Set
    Error creating formatter: html (NameError)
    org/jruby/RubyModule.java:2690:in `const_missing'
    /Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/gems/syntax-1.2.0/lib/syntax         /lang/ruby.rb:11:in `Ruby'
    /Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/gems/syntax-1.2.0/lib/syntax  /lang/ruby.rb:8:in `Syntax'
    /Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/gems/syntax-1.2.0/lib/syntax/lang/ruby.rb:3:in `(root)'
    org/jruby/RubyKernel.java:1083:in `require'
    /Users/Casey.Guerrero/.rvm/rubies/jruby-1.7.10/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:55:in `require'
    /Users/Casey.Guerrero/.rvm/rubies/jruby-1.7.10/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:53:in `require'
    /Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/gems/syntax-1.2.0/lib/syntax.rb:1:in `(root)'
    /Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/gems/syntax-1.2.0/lib/syntax.rb:24:in `load'
    /Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/gems/syntax-1.2.0/lib/syntax/convertors/abstract.rb:16:in `for_syntax'
    /Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/gems/cucumber-1.3.14/bin/../lib/cucumber/formatter/html.rb:580:in `SnippetExtractor'
    /Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/gems/cucumber-1.3.14/bin/../lib/cucumber/formatter/html.rb:578:in `Html'
    /Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/gems/cucumber-1.3.14/bin/../lib/cucumber/formatter/html.rb:8:in `Formatter'
    /Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/gems/cucumber-1.3.14/bin/../lib/cucumber/formatter/html.rb:7:in `Cucumber'
org/jruby/RubyKernel.java:1083:in `require'
    /Users/Casey.Guerrero/.rvm/rubies/jruby-1.7.10/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:55:in `require'
    /Users/Casey.Guerrero/.rvm/rubies/jruby-1.7.10/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:53:in `require'
    /Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/gems/cucumber-1.3.14/bin/../lib/cucumber/formatter/html.rb:6:in `(root)'
    /Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/gems/cucumber-1.3.14/bin/../lib/cucumber/constantize.rb:1:in `(root)'
    /Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/gems/cucumber-1.3.14/bin/../lib/cucumber/constantize.rb:17:in `constantize'
    org/jruby/RubyArray.java:2409:in `map'
    /Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/gems/cucumber-1.3.14/bin/../lib/cucumber/cli/configuration.rb:81:in `formatter_class'
    /Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/gems/cucumber-1.3.14/bin/../lib/cucumber/cli/configuration.rb:182:in `formatters'
    /Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/gems/cucumber-1.3.14/bin/../lib/cucumber/cli/configuration.rb:178:in `formatters'
    /Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/gems/cucumber-1.3.14/bin/../lib/cucumber/cli/configuration.rb:76:in `build_tree_walker'
    /Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/gems/cucumber-1.3.14/bin/../lib/cucumber/runtime.rb:46:in `run!'
    org/jruby/RubyKernel.java:1099:in `load'
    /Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/gems/cucumber-1.3.14/bin/../lib/cucumber/cli/main.rb:47:in `execute!'
    org/jruby/RubyKernel.java:1119:in `eval'
    /Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/bin/jruby_executable_hooks:15:in `(root)'
使用
cucumber-1.3.14
jruby-1.7.10
,尽管错误发生在
jruby-1.7.4
中。支持目录中没有包含格式设置程序,也没有在
env.rb.
中的任何位置引用格式设置程序。这些格式设置程序不使用rake或运行单个功能的任何东西。奇怪的是,其他功能文件夹可以输出与失败文件夹具有相同命令参数的html报告。例如:

cucumber features/AddText.feature -f html -o report.html -f pretty 

任何见解都会有所帮助

更新:


出于某种原因,卸载“syntax”gem可以运行功能并生成html报告。我的印象是“syntax”是一个“cucumber”依赖项…

当cucumber中出现测试失败时,将向控制台写入以下行:

# gem install syntax to get syntax highlighting
不幸的是,这会导致人们安装syntax gem,这也是导致错误的原因


请执行“
gem uninstall syntax
”或“
sudo gem uninstall syntax
”以避免此错误。

运行“gem uninstall syntax”将正常运行

我知道这是一个有点旧的线程,但希望清除一些问题

黄瓜1.3.17和1.3.18取决于语法>=1.0.0

在目前的情况下,问题是syntax 1.2.0,而不是syntax的所有版本

所以我们应该做的是

卸载syntax 1.2.0并安装syntax 1.0.0

sudo gem install syntax -v 1.0.0
sudo gem install syntax -v 1.0.0