rails/rails-dom-testing

uninitialized constant HTMLSelector::Minitest after update to 2.1.0

xxx opened this issue ยท 13 comments

xxx commented

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>'

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 commented

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

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.

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)

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

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 commented

@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.

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

xxx commented

@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.

@xxx Yeah, that is strange...

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 commented

I can confirm that 2.1.1 fixes me. thanks!