rails/web-console

Web-console enabled in test environment breaks the rails6 report wrapper

Shelvak opened this issue · 2 comments

Hi there, sorry to bother you with that issue but I'm upgrading to Rails 6 and after a lot of debugging I figured out that, if I enable web-console in test that breaks the skip exceptions.
Only with the new Rails6 parallelize(workers: XXX) option for test, that raise the next error:

 mini_test_skip(master)☠→ rails test      
Run options: --seed 7952

# Running:

Traceback (most recent call last):
        11: from /home/rotsen/.gem/ruby/2.5.3/gems/minitest-5.11.3/lib/minitest.rb:63:in `block in autorun'
        10: from /home/rotsen/.gem/ruby/2.5.3/gems/minitest-5.11.3/lib/minitest.rb:133:in `run'
         9: from /home/rotsen/.gem/ruby/2.5.3/gems/activesupport-6.0.0.beta1/lib/active_support/testing/parallelization.rb:70:in `start'
         8: from /home/rotsen/.gem/ruby/2.5.3/gems/activesupport-6.0.0.beta1/lib/active_support/testing/parallelization.rb:70:in `map'
         7: from /home/rotsen/.gem/ruby/2.5.3/gems/activesupport-6.0.0.beta1/lib/active_support/testing/parallelization.rb:70:in `each'
         6: from /home/rotsen/.gem/ruby/2.5.3/gems/activesupport-6.0.0.beta1/lib/active_support/testing/parallelization.rb:70:in `times'
         5: from /home/rotsen/.gem/ruby/2.5.3/gems/activesupport-6.0.0.beta1/lib/active_support/testing/parallelization.rb:71:in `block in start'
         4: from /home/rotsen/.gem/ruby/2.5.3/gems/activesupport-6.0.0.beta1/lib/active_support/testing/parallelization.rb:71:in `fork'
         3: from /home/rotsen/.gem/ruby/2.5.3/gems/activesupport-6.0.0.beta1/lib/active_support/testing/parallelization.rb:84:in `block (2 levels) in start'
         2: from /home/rotsen/.gem/ruby/2.5.3/gems/activesupport-6.0.0.beta1/lib/active_support/testing/parallelization.rb:87:in `rescue in block (2 levels) in start'
         1: from /home/rotsen/.gem/ruby/2.5.3/gems/activesupport-6.0.0.beta1/lib/active_support/testing/parallelization.rb:87:in `each'
/home/rotsen/.gem/ruby/2.5.3/gems/activesupport-6.0.0.beta1/lib/active_support/testing/parallelization.rb:88:in `block (3 levels) in start': undefined method `exception=' for #<Minitest::Skip: Skipping> (NoMethodError)
Did you mean?  exception

I created a new rails 6.beta1 app with web-console enabled globally and the next sample test:

  test 'hello' do
    skip "Skipping"
  end

If I just change the gem to group dev/prod, everything works as espected:

group :development, :production do
  gem 'web-console'
end

Ref: Rails6 raise in line => https://github.com/rails/rails/blob/v6.0.0.beta1/activesupport/lib/active_support/testing/parallelization.rb#L88

Note: I need web-console in test & production because I gave the possibility to test things via web (dangerous, I know 😆 )

Extras:
ruby -v => ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-linux]

Gemfile.lock # only with rails, pg and web-console
GEM
  remote: https://rubygems.org/
  specs:
    actioncable (6.0.0.beta1)
      actionpack (= 6.0.0.beta1)
      nio4r (~> 2.0)
      websocket-driver (>= 0.6.1)
    actionmailbox (6.0.0.beta1)
      actionpack (= 6.0.0.beta1)
      activejob (= 6.0.0.beta1)
      activerecord (= 6.0.0.beta1)
      activestorage (= 6.0.0.beta1)
      activesupport (= 6.0.0.beta1)
      mail (>= 2.7.1)
    actionmailer (6.0.0.beta1)
      actionpack (= 6.0.0.beta1)
      actionview (= 6.0.0.beta1)
      activejob (= 6.0.0.beta1)
      mail (~> 2.5, >= 2.5.4)
      rails-dom-testing (~> 2.0)
    actionpack (6.0.0.beta1)
      actionview (= 6.0.0.beta1)
      activesupport (= 6.0.0.beta1)
      rack (~> 2.0)
      rack-test (>= 0.6.3)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.0, >= 1.0.2)
    actiontext (6.0.0.beta1)
      actionpack (= 6.0.0.beta1)
      activerecord (= 6.0.0.beta1)
      activestorage (= 6.0.0.beta1)
      activesupport (= 6.0.0.beta1)
      nokogiri (>= 1.8.5)
    actionview (6.0.0.beta1)
      activesupport (= 6.0.0.beta1)
      builder (~> 3.1)
      erubi (~> 1.4)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.0, >= 1.0.3)
    activejob (6.0.0.beta1)
      activesupport (= 6.0.0.beta1)
      globalid (>= 0.3.6)
    activemodel (6.0.0.beta1)
      activesupport (= 6.0.0.beta1)
    activerecord (6.0.0.beta1)
      activemodel (= 6.0.0.beta1)
      activesupport (= 6.0.0.beta1)
    activestorage (6.0.0.beta1)
      actionpack (= 6.0.0.beta1)
      activerecord (= 6.0.0.beta1)
      marcel (~> 0.3.1)
    activesupport (6.0.0.beta1)
      concurrent-ruby (~> 1.0, >= 1.0.2)
      i18n (>= 0.7, < 2)
      minitest (~> 5.1)
      tzinfo (~> 1.1)
    bindex (0.5.0)
    builder (3.2.3)
    concurrent-ruby (1.1.4)
    crass (1.0.4)
    erubi (1.8.0)
    globalid (0.4.2)
      activesupport (>= 4.2.0)
    i18n (1.5.3)
      concurrent-ruby (~> 1.0)
    loofah (2.2.3)
      crass (~> 1.0.2)
      nokogiri (>= 1.5.9)
    mail (2.7.1)
      mini_mime (>= 0.1.1)
    marcel (0.3.3)
      mimemagic (~> 0.3.2)
    method_source (0.9.2)
    mimemagic (0.3.3)
    mini_mime (1.0.1)
    mini_portile2 (2.4.0)
    minitest (5.11.3)
    nio4r (2.3.1)
    nokogiri (1.10.1)
      mini_portile2 (~> 2.4.0)
    pg (1.1.4)
    rack (2.0.6)
    rack-test (1.1.0)
      rack (>= 1.0, < 3)
    rails (6.0.0.beta1)
      actioncable (= 6.0.0.beta1)
      actionmailbox (= 6.0.0.beta1)
      actionmailer (= 6.0.0.beta1)
      actionpack (= 6.0.0.beta1)
      actiontext (= 6.0.0.beta1)
      actionview (= 6.0.0.beta1)
      activejob (= 6.0.0.beta1)
      activemodel (= 6.0.0.beta1)
      activerecord (= 6.0.0.beta1)
      activestorage (= 6.0.0.beta1)
      activesupport (= 6.0.0.beta1)
      bundler (>= 1.3.0)
      railties (= 6.0.0.beta1)
      sprockets-rails (>= 2.0.0)
    rails-dom-testing (2.0.3)
      activesupport (>= 4.2.0)
      nokogiri (>= 1.6)
    rails-html-sanitizer (1.0.4)
      loofah (~> 2.2, >= 2.2.2)
    railties (6.0.0.beta1)
      actionpack (= 6.0.0.beta1)
      activesupport (= 6.0.0.beta1)
      method_source
      rake (>= 0.8.7)
      thor (>= 0.20.3, < 2.0)
    rake (12.3.2)
    sprockets (3.7.2)
      concurrent-ruby (~> 1.0)
      rack (> 1, < 3)
    sprockets-rails (3.2.1)
      actionpack (>= 4.0)
      activesupport (>= 4.0)
      sprockets (>= 3.0.0)
    thor (0.20.3)
    thread_safe (0.3.6)
    tzinfo (1.2.5)
      thread_safe (~> 0.1)
    web-console (3.7.0)
      actionview (>= 5.0)
      activemodel (>= 5.0)
      bindex (>= 0.4.0)
      railties (>= 5.0)
    websocket-driver (0.7.0)
      websocket-extensions (>= 0.1.0)
    websocket-extensions (0.1.3)

PLATFORMS
  ruby

DEPENDENCIES
  pg (>= 0.18, < 2.0)
  rails (~> 6.0.0.beta1)
  web-console (>= 3.3.0)

RUBY VERSION
   ruby 2.5.3p105

BUNDLED WITH
   2.0.1

If you need anything else, just ping me.

Thanks in advance.

Checking the dependencies and the web-console code, I noticed the bindex gem.
If I comment in the local gem the require 'bindex' from lib/web_console/railtie.rb that solve the problem (but I can't render the console method obviously).

Bindex is what makes Web Console tick. I'll have to check, but don't expect to be able to run web-console in the test environment as we're not officially supporting this.

You may play with the Gemfile:

gem 'web-console`: require: false

And manually requiring it when running the server and not the tests.