Skip to content

uninitialized constant HTMLSelector::Minitest after update to 2.1.0 #107

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
xxx opened this issue Jun 30, 2023 · 13 comments
Closed

uninitialized constant HTMLSelector::Minitest after update to 2.1.0 #107

xxx opened this issue Jun 30, 2023 · 13 comments

Comments

@xxx
Copy link

xxx commented Jun 30, 2023

Hi, I'm doing some gem updates today, and starting seeing this when I try to run tests. rails-dom-testing is in our bundle as a dependency of other packages, but we do not use it ourselves directly.

Is there some new configuration I need to add? I didn't see anything documented.

full trace:

NameError:
  uninitialized constant HTMLSelector::Minitest
# /home/mpd/.rvm/gems/ruby-3.2.2/gems/rails-dom-testing-2.1.0/lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb:7:in `<class:HTMLSelector>'
# /home/mpd/.rvm/gems/ruby-3.2.2/gems/rails-dom-testing-2.1.0/lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb:4:in `<main>'
# /home/mpd/.rvm/gems/ruby-3.2.2/gems/rails-dom-testing-2.1.0/lib/rails/dom/testing/assertions/selector_assertions.rb:2:in `require_relative'
# /home/mpd/.rvm/gems/ruby-3.2.2/gems/rails-dom-testing-2.1.0/lib/rails/dom/testing/assertions/selector_assertions.rb:2:in `<main>'
# /home/mpd/.rvm/gems/ruby-3.2.2/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
# /home/mpd/.rvm/gems/ruby-3.2.2/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
# /home/mpd/.rvm/gems/ruby-3.2.2/gems/jquery-rails-4.5.1/lib/jquery/assert_select.rb:1:in `<main>'
# /home/mpd/.rvm/gems/ruby-3.2.2/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
# /home/mpd/.rvm/gems/ruby-3.2.2/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
# /home/mpd/.rvm/gems/ruby-3.2.2/gems/jquery-rails-4.5.1/lib/jquery/rails.rb:1:in `<main>'
# /home/mpd/.rvm/gems/ruby-3.2.2/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
# /home/mpd/.rvm/gems/ruby-3.2.2/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
# /home/mpd/.rvm/gems/ruby-3.2.2/gems/jquery-rails-4.5.1/lib/jquery-rails.rb:1:in `<main>'
# /home/mpd/.rvm/gems/ruby-3.2.2/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
# /home/mpd/.rvm/gems/ruby-3.2.2/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
# /home/mpd/.rvm/gems/ruby-3.2.2/gems/administrate-0.18.0/lib/administrate/engine.rb:1:in `<main>'
# /home/mpd/.rvm/gems/ruby-3.2.2/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
# /home/mpd/.rvm/gems/ruby-3.2.2/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
# /home/mpd/.rvm/gems/ruby-3.2.2/gems/administrate-0.18.0/lib/administrate.rb:1:in `<main>'
# /home/mpd/.rvm/gems/ruby-3.2.2/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
# /home/mpd/.rvm/gems/ruby-3.2.2/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
# /home/mpd/.rvm/gems/ruby-3.2.2/gems/bundler-2.3.7/lib/bundler.rb:176:in `require'
# ./config/application.rb:16:in `<main>'
# ./config/environment.rb:3:in `require_relative'
# ./config/environment.rb:3:in `<main>'
# /home/mpd/.rvm/gems/ruby-3.2.2/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
# /home/mpd/.rvm/gems/ruby-3.2.2/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
# ./spec/rails_helper.rb:5:in `<main>'
# /home/mpd/.rvm/gems/ruby-3.2.2/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
# /home/mpd/.rvm/gems/ruby-3.2.2/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
# ./spec/services/workstreams/update_workstream_summary_schedule_spec.rb:3:in `<main>'
@joeadcock
Copy link

I am also getting the uninitialized constant HTMLSelector::Minitest errors when running RSpec tests. I have not able to replicate it on a new sample project though.

@robbl
Copy link

robbl commented Jun 30, 2023

Im pretty sure the error was introduced with #106. The workaround is to require 'minitest' in your spec_helper.

@iagopuccini
Copy link

I'm also getting this error over here, I'm upgrading the Ruby version of an application, and this error was returned when bumping from Ruby version 2.6.8 to 2.6.9. During the execution of the tests I don't have any problems, but when running the server the error uninitialized constant HTMLSelector::Minitest is displayed.

@heynan0
Copy link

heynan0 commented Jun 30, 2023

I got the problem after upgrading dartsass-rails to 0.5.0, which somewhat triggered some additional upgrade on this gem, rails-dom-testing.

-    rails-dom-testing (2.0.3)
-      activesupport (>= 4.2.0)
+    rails-dom-testing (2.1.0)
+      activesupport (>= 5.0.0)

@heynan0
Copy link

heynan0 commented Jun 30, 2023

cc @rafaelfranca @flavorjones

@iagopuccini
Copy link

iagopuccini commented Jun 30, 2023

Hi, I'm doing some gem updates today, and starting seeing this when I try to run tests. rails-dom-testing is in our bundle as a dependency of other packages, but we do not use it ourselves directly.

Is there some new configuration I need to add? I didn't see anything documented.

full trace:

NameError:
  uninitialized constant HTMLSelector::Minitest
# /home/mpd/.rvm/gems/ruby-3.2.2/gems/rails-dom-testing-2.1.0/lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb:7:in `<class:HTMLSelector>'
# /home/mpd/.rvm/gems/ruby-3.2.2/gems/rails-dom-testing-2.1.0/lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb:4:in `<main>'
# /home/mpd/.rvm/gems/ruby-3.2.2/gems/rails-dom-testing-2.1.0/lib/rails/dom/testing/assertions/selector_assertions.rb:2:in `require_relative'
# /home/mpd/.rvm/gems/ruby-3.2.2/gems/rails-dom-testing-2.1.0/lib/rails/dom/testing/assertions/selector_assertions.rb:2:in `<main>'
# /home/mpd/.rvm/gems/ruby-3.2.2/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
# /home/mpd/.rvm/gems/ruby-3.2.2/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
# /home/mpd/.rvm/gems/ruby-3.2.2/gems/jquery-rails-4.5.1/lib/jquery/assert_select.rb:1:in `<main>'
# /home/mpd/.rvm/gems/ruby-3.2.2/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
# /home/mpd/.rvm/gems/ruby-3.2.2/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
# /home/mpd/.rvm/gems/ruby-3.2.2/gems/jquery-rails-4.5.1/lib/jquery/rails.rb:1:in `<main>'
# /home/mpd/.rvm/gems/ruby-3.2.2/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
# /home/mpd/.rvm/gems/ruby-3.2.2/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
# /home/mpd/.rvm/gems/ruby-3.2.2/gems/jquery-rails-4.5.1/lib/jquery-rails.rb:1:in `<main>'
# /home/mpd/.rvm/gems/ruby-3.2.2/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
# /home/mpd/.rvm/gems/ruby-3.2.2/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
# /home/mpd/.rvm/gems/ruby-3.2.2/gems/administrate-0.18.0/lib/administrate/engine.rb:1:in `<main>'
# /home/mpd/.rvm/gems/ruby-3.2.2/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
# /home/mpd/.rvm/gems/ruby-3.2.2/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
# /home/mpd/.rvm/gems/ruby-3.2.2/gems/administrate-0.18.0/lib/administrate.rb:1:in `<main>'
# /home/mpd/.rvm/gems/ruby-3.2.2/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
# /home/mpd/.rvm/gems/ruby-3.2.2/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
# /home/mpd/.rvm/gems/ruby-3.2.2/gems/bundler-2.3.7/lib/bundler.rb:176:in `require'
# ./config/application.rb:16:in `<main>'
# ./config/environment.rb:3:in `require_relative'
# ./config/environment.rb:3:in `<main>'
# /home/mpd/.rvm/gems/ruby-3.2.2/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
# /home/mpd/.rvm/gems/ruby-3.2.2/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
# ./spec/rails_helper.rb:5:in `<main>'
# /home/mpd/.rvm/gems/ruby-3.2.2/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
# /home/mpd/.rvm/gems/ruby-3.2.2/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
# ./spec/services/workstreams/update_workstream_summary_schedule_spec.rb:3:in `<main>'

After performing some tests in my application, I was able to run the server again successfully, but I had to add the gem explicitly to

    group :test do 
      gem 'rails-dom-testing', '~> 2.0.3'
    end

@joeadcock
Copy link

it looks like adding jquery-rails to the Gemfile is an easy way to replicate the issue.

Here is a sample repo: https://github.com/joeadcock/rails-dom-testing-2.1.0-bug

@xxx
Copy link
Author

xxx commented Jun 30, 2023

@iagopuccini yeah, we're currently on 2.0.3 and it works, but locking to that version prevents a bunch of other gems from updating.

@joeadcock
Copy link

@xxx Adding gem 'rails-dom-testing', '< 2.1.0' should fix your immediate problem

@xxx
Copy link
Author

xxx commented Jun 30, 2023

@joeadcock thanks, that does work, though I guess I don't understand why specifying the version that way allows other gems to be updated, while locking to 2.0.3 doesn't.

@joeadcock
Copy link

@xxx Yeah, that is strange...

@rafaelfranca
Copy link
Member

wow, that was quick. Thank you folks for reporting 2.1.1 should have fixed it. Let me know if it is still happening.

@xxx
Copy link
Author

xxx commented Jun 30, 2023

I can confirm that 2.1.1 fixes me. thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

6 participants