allure-ruby icon indicating copy to clipboard operation
allure-ruby copied to clipboard

`require': cannot load such file -- allure_rspec_formatter (LoadError)

Open engineermanmohansingh opened this issue 1 year ago • 1 comments

Describe the Bug

Observing NameError when using allure-rspec in a ruby project - uninitialized constant AllureRspecFormatter. This is causing LoadError when executing rspec files with --format AllureRspecFormatter

Steps to Reproduce

I followed the steps mentioned in this doc - https://allurereport.org/docs/rspec/ I had installed allure-rspec and rspec gem in a scratch project. After doing bundle install , I had executed the spec using this command - bundle exec rspec . Following NameError is observed. apple@192 polishRuby % bundle exec rspec No examples found. bundler: failed to load command: rspec (/Users/apple/.asdf/installs/ruby/3.1.2/bin/rspec) /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.13.0/lib/rspec/core/formatters.rb:241:in require': cannot load such file -- allure_rspec_formatter (LoadError) from /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.13.0/lib/rspec/core/formatters.rb:241:in rescue in custom_formatter' from /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.13.0/lib/rspec/core/formatters.rb:238:in custom_formatter' from /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.13.0/lib/rspec/core/formatters.rb:183:in find_formatter' from /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.13.0/lib/rspec/core/formatters.rb:152:in add' from /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.13.0/lib/rspec/core/configuration.rb:997:in add_formatter' from /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.13.0/lib/rspec/core/configuration_options.rb:122:in block in load_formatters_into' from /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.13.0/lib/rspec/core/configuration_options.rb:122:in each' from /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.13.0/lib/rspec/core/configuration_options.rb:122:in load_formatters_into' from /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.13.0/lib/rspec/core/configuration_options.rb:24:in configure' from /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.13.0/lib/rspec/core/runner.rb:132:in configure' from /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.13.0/lib/rspec/core/runner.rb:99:in setup' from /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.13.0/lib/rspec/core/runner.rb:86:in run' from /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.13.0/lib/rspec/core/runner.rb:71:in run' from /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.13.0/lib/rspec/core/runner.rb:45:in invoke' from /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.13.0/exe/rspec:4:in <top (required)>' from /Users/apple/.asdf/installs/ruby/3.1.2/bin/rspec:25:in load' from /Users/apple/.asdf/installs/ruby/3.1.2/bin/rspec:25:in <top (required)>' from /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/cli/exec.rb:58:in load' from /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/cli/exec.rb:58:in kernel_load' from /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/cli/exec.rb:23:in run' from /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/cli.rb:492:in exec' from /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/vendor/thor/lib/thor/command.rb:27:in run' from /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in invoke_command' from /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/vendor/thor/lib/thor.rb:392:in dispatch' from /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/cli.rb:34:in dispatch' from /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/vendor/thor/lib/thor/base.rb:485:in start' from /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/cli.rb:28:in start' from /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.13/exe/bundle:45:in block in <top (required)>' from /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/friendly_errors.rb:117:in with_friendly_errors' from /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.13/exe/bundle:33:in <top (required)>' from /Users/apple/.asdf/installs/ruby/3.1.2/bin/bundle:25:in load' from /Users/apple/.asdf/installs/ruby/3.1.2/bin/bundle:25:in

' /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.13.0/lib/rspec/core/formatters.rb:239:in `block in custom_formatter': uninitialized constant AllureRspecFormatter (NameError)

      formatter_ref.gsub(/^::/, '').split('::').inject(Object) { |a, e| a.const_get e }
                                                                         ^^^^^^^^^^
from /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.13.0/lib/rspec/core/formatters.rb:239:in `each'
from /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.13.0/lib/rspec/core/formatters.rb:239:in `inject'
from /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.13.0/lib/rspec/core/formatters.rb:239:in `custom_formatter'
from /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.13.0/lib/rspec/core/formatters.rb:183:in `find_formatter'
from /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.13.0/lib/rspec/core/formatters.rb:152:in `add'
from /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.13.0/lib/rspec/core/configuration.rb:997:in `add_formatter'
from /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.13.0/lib/rspec/core/configuration_options.rb:122:in `block in load_formatters_into'
from /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.13.0/lib/rspec/core/configuration_options.rb:122:in `each'
from /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.13.0/lib/rspec/core/configuration_options.rb:122:in `load_formatters_into'
from /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.13.0/lib/rspec/core/configuration_options.rb:24:in `configure'
from /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.13.0/lib/rspec/core/runner.rb:132:in `configure'
from /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.13.0/lib/rspec/core/runner.rb:99:in `setup'
from /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.13.0/lib/rspec/core/runner.rb:86:in `run'
from /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.13.0/lib/rspec/core/runner.rb:71:in `run'
from /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.13.0/lib/rspec/core/runner.rb:45:in `invoke'
from /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rspec-core-3.13.0/exe/rspec:4:in `<top (required)>'
from /Users/apple/.asdf/installs/ruby/3.1.2/bin/rspec:25:in `load'
from /Users/apple/.asdf/installs/ruby/3.1.2/bin/rspec:25:in `<top (required)>'
from /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/cli/exec.rb:58:in `load'
from /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/cli/exec.rb:58:in `kernel_load'
from /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/cli/exec.rb:23:in `run'
from /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/cli.rb:492:in `exec'
from /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
from /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
from /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
from /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/cli.rb:34:in `dispatch'
from /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
from /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/cli.rb:28:in `start'
from /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.13/exe/bundle:45:in `block in <top (required)>'
from /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.13/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
from /Users/apple/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.4.13/exe/bundle:33:in `<top (required)>'
from /Users/apple/.asdf/installs/ruby/3.1.2/bin/bundle:25:in `load'
from /Users/apple/.asdf/installs/ruby/3.1.2/bin/bundle:25:in `<main>'

apple@192 polishRuby % `

Expected Behaviour

Custom formatter name should be supported and identified out of the box.

Screenshots or Additional Context

No response

What Language are you using?

Ruby

What Framework/Allure Integration you are using?

Allure RSpec

What version of Allure Integration you are using?

2.24.5

What version of Allure Report you are using?

2.29.0

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

engineermanmohansingh avatar Jul 12 '24 18:07 engineermanmohansingh

Please follow the example in https://github.com/allure-examples/allure-rspec-example. This is some kind of issue with your configuration which leads to allure-rspec not being loaded.

andrcuns avatar Jul 15 '24 16:07 andrcuns

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days

github-actions[bot] avatar Aug 15 '24 02:08 github-actions[bot]