Giter VIP home page Giter VIP logo

Comments (10)

trobrock avatar trobrock commented on September 21, 2024 1

@ArturT thanks for all the help. That did it!

from knapsack_pro-ruby.

trobrock avatar trobrock commented on September 21, 2024

In case it helps, here is the stack with --trace enabled:

rake aborted!
NameError: uninitialized constant RSpec::Core::Parser

        ::RSpec::Core::Parser.parse(cli_args)
                     ^^^^^^^^
Did you mean?  ParseError
/home/runner/work/comfortly/comfortly/vendor/bundle/ruby/3.1.0/gems/knapsack_pro-3.4.1/lib/knapsack_pro/adapters/rspec_adapter.rb:111:in `parsed_options'
/home/runner/work/comfortly/comfortly/vendor/bundle/ruby/3.1.0/gems/knapsack_pro-3.4.1/lib/knapsack_pro/adapters/rspec_adapter.rb:15:in `has_tag_option?'
/home/runner/work/comfortly/comfortly/vendor/bundle/ruby/3.1.0/gems/knapsack_pro-3.4.1/lib/knapsack_pro/adapters/rspec_adapter.rb:7:in `ensure_no_tag_option_when_rspec_split_by_test_examples_enabled!'
/home/runner/work/comfortly/comfortly/vendor/bundle/ruby/3.1.0/gems/knapsack_pro-3.4.1/lib/knapsack_pro/runners/rspec_runner.rb:16:in `run'
/home/runner/work/comfortly/comfortly/vendor/bundle/ruby/3.1.0/gems/knapsack_pro-3.4.1/lib/tasks/rspec.rake:5:in `block (2 levels) in <main>'
/home/runner/work/comfortly/comfortly/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `block in execute'
/home/runner/work/comfortly/comfortly/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `each'
/home/runner/work/comfortly/comfortly/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `execute'
/home/runner/work/comfortly/comfortly/vendor/bundle/ruby/3.1.0/gems/airbrake-13.0.3/lib/airbrake/rake.rb:17:in `execute'
/home/runner/work/comfortly/comfortly/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
/home/runner/work/comfortly/comfortly/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `synchronize'
/home/runner/work/comfortly/comfortly/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `invoke_with_call_chain'
/home/runner/work/comfortly/comfortly/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:188:in `invoke'
/home/runner/work/comfortly/comfortly/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:160:in `invoke_task'
/home/runner/work/comfortly/comfortly/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/home/runner/work/comfortly/comfortly/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `each'
/home/runner/work/comfortly/comfortly/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block in top_level'
/home/runner/work/comfortly/comfortly/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:125:in `run_with_threads'
/home/runner/work/comfortly/comfortly/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:110:in `top_level'
/home/runner/work/comfortly/comfortly/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:83:in `block in run'
/home/runner/work/comfortly/comfortly/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:186:in `standard_exception_handling'
/home/runner/work/comfortly/comfortly/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:[80](https://github.com/getcomfortly/comfortly/actions/runs/3514104066/jobs/5887706866#step:7:81):in `run'
/home/runner/work/comfortly/comfortly/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
/home/runner/work/comfortly/comfortly/vendor/bundle/ruby/3.1.0/bin/rake:25:in `load'
/home/runner/work/comfortly/comfortly/vendor/bundle/ruby/3.1.0/bin/rake:25:in `<top (required)>'
/opt/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/gems/3.1.0/gems/bundler-2.3.13/lib/bundler/cli/exec.rb:58:in `load'
/opt/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/gems/3.1.0/gems/bundler-2.3.13/lib/bundler/cli/exec.rb:58:in `kernel_load'
/opt/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/gems/3.1.0/gems/bundler-2.3.13/lib/bundler/cli/exec.rb:23:in `run'
/opt/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/gems/3.1.0/gems/bundler-2.3.13/lib/bundler/cli.rb:4[83](https://github.com/getcomfortly/comfortly/actions/runs/3514104066/jobs/5887706866#step:7:84):in `exec'
/opt/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/gems/3.1.0/gems/bundler-2.3.13/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/opt/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/gems/3.1.0/gems/bundler-2.3.13/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/opt/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/gems/3.1.0/gems/bundler-2.3.13/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
/opt/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/gems/3.1.0/gems/bundler-2.3.13/lib/bundler/cli.rb:31:in `dispatch'
/opt/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/gems/3.1.0/gems/bundler-2.3.13/lib/bundler/vendor/thor/lib/thor/base.rb:4[85](https://github.com/getcomfortly/comfortly/actions/runs/3514104066/jobs/5887706866#step:7:86):in `start'
/opt/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/gems/3.1.0/gems/bundler-2.3.13/lib/bundler/cli.rb:25:in `start'
/opt/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/gems/3.1.0/gems/bundler-2.3.13/exe/bundle:48:in `block in <top (required)>'
/opt/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/gems/3.1.0/gems/bundler-2.3.13/lib/bundler/friendly_errors.rb:[103](https://github.com/getcomfortly/comfortly/actions/runs/3514104066/jobs/5887706866#step:7:104):in `with_friendly_errors'
/opt/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/gems/3.1.0/gems/bundler-2.3.13/exe/bundle:36:in `<top (required)>'
/opt/hostedtoolcache/Ruby/3.1.2/x64/bin/bundle:25:in `load'
/opt/hostedtoolcache/Ruby/3.1.2/x64/bin/bundle:25:in `<main>'
Tasks: TOP => knapsack_pro:rspec

from knapsack_pro-ruby.

ArturT avatar ArturT commented on September 21, 2024

This error is related to the latest improvement in the knapsack_pro gem 3.4.1.

I've checked if there were any internal changes in the RSpec 3.12.0 but I don't see anything that could impact the ::RSpec::Core::Parser. I also run tests on my local project with RSpec 3.12.0 and it works with the RSpec split by test examples feature.

I suspect you did not load RSpec in the test environment, or maybe you loaded the knapsack_pro gem before RSpec.

Where do you require knapsack_pro? In spec_helper or rails_helper? Is it loaded after RSpec? Can you share the config file?

from knapsack_pro-ruby.

trobrock avatar trobrock commented on September 21, 2024

@ArturT I load it at the very top of spec_helper.rb

My Gemfile:

group :development, :test do
  gem 'awesome_print'
  gem 'debug', '>= 1.0.0', platforms: %i(mri mingw x64_mingw)
  gem 'knapsack_pro'
  gem 'rspec-rails'
end

spec_helper.rb:

# frozen_string_literal: true

require 'knapsack_pro'
KnapsackPro::Adapters::RSpecAdapter.bind

# This file was generated by the `rails generate rspec:install` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# The generated `.rspec` file contains `--require spec_helper` which will cause
# this file to always be loaded, without a need to explicitly require it in any
# files.
#
# Given that it is always loaded, you are encouraged to keep this file as
# light-weight as possible. Requiring heavyweight dependencies from this file
# will add to the boot time of your test suite on EVERY test run, even for an
# individual file that may not need all of that loaded. Instead, consider making
# a separate helper file that requires the additional dependencies and performs
# the additional setup, and require it from the spec files that actually need
# it.
#
# See https://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
RSpec.configure do |config|
  # rspec-expectations config goes here. You can use an alternate
  # assertion/expectation library such as wrong or the stdlib/minitest
  # assertions if you prefer.
  config.expect_with :rspec do |expectations|
    # This option will default to `true` in RSpec 4. It makes the `description`
    # and `failure_message` of custom matchers include text for helper methods
    # defined using `chain`, e.g.:
    #     be_bigger_than(2).and_smaller_than(4).description
    #     # => "be bigger than 2 and smaller than 4"
    # ...rather than:
    #     # => "be bigger than 2"
    expectations.include_chain_clauses_in_custom_matcher_descriptions = true
  end

.......

from knapsack_pro-ruby.

trobrock avatar trobrock commented on September 21, 2024

I've now also tried putting that knapsack require code at the bottom of the spec_helper and the bottom of the rails_helper. Neither worked.

from knapsack_pro-ruby.

ArturT avatar ArturT commented on September 21, 2024

Do you use Rails?
EDITED: Never mind, I see the rspec-rails gem so I assume you use Rails.

How do you start the knapsack_pro command?

from knapsack_pro-ruby.

ArturT avatar ArturT commented on September 21, 2024

Could you try the knapsack_pro 3.4.0 version? This should solve the issue temporarily, but I'm curious if we are going to see another issue that could be the root issue of why RSpec is not loaded.

from knapsack_pro-ruby.

ArturT avatar ArturT commented on September 21, 2024

I've managed to reproduce the error when RAILS_ENV=test is missing then I get the same error.

Can you ensure you added in your CI environment:

export RAILS_ENV=test

from knapsack_pro-ruby.

ArturT avatar ArturT commented on September 21, 2024

@trobrock We've released a new knapsack_pro gem version 3.4.2 with a fix. Could you try it? Please let me know if this helps.

from knapsack_pro-ruby.

ArturT avatar ArturT commented on September 21, 2024

@trobrock Awesome! Thanks for letting me know.

from knapsack_pro-ruby.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.