When I run minitest in vscode's Ruby Test Explorer, NoMethodError: undefined method `klass'for ...

tl;dr

environment

Introduction

test/test_import.rb


require 'minitest/unit'
require 'minitest/autorun'


class TestFoo < MiniTest::Test
  def setup
  end

  def test_foo
    assert_equal 1, 1
  end
end
[2021-01-20 09:38:33.897] [INFO] Running command: bundle exec rake -R $EXT_DIR vscode:minitest:run 'test/test_import.rb:9'
[2021-01-20 09:38:34.562] [DEBUG] [CHILD PROCESS OUTPUT] 
[2021-01-20 09:38:34.562] [DEBUG] [CHILD PROCESS OUTPUT] RUNNING: ./test/test_import.rb[9]
[2021-01-20 09:38:34.563] [DEBUG] [CHILD PROCESS OUTPUT] rake aborted!
[2021-01-20 09:38:34.564] [DEBUG] [CHILD PROCESS OUTPUT] NoMethodError: undefined method `klass' for #<TestFoo:0x00007fa8ad1c15f8>
[2021-01-20 09:38:34.564] [DEBUG] [CHILD PROCESS OUTPUT] Did you mean?  class
[2021-01-20 09:38:34.564] [DEBUG] [CHILD PROCESS OUTPUT] /Users/murasawa/.vscode/extensions/connorshea.vscode-ruby-test-adapter-0.8.0/ruby/vscode/minitest/reporter.rb:66:in `vscode_result'
[2021-01-20 09:38:34.564] [DEBUG] [CHILD PROCESS OUTPUT] /Users/murasawa/.vscode/extensions/connorshea.vscode-ruby-test-adapter-0.8.0/ruby/vscode/minitest/reporter.rb:27:in `record'
[2021-01-20 09:38:34.564] [DEBUG] [CHILD PROCESS OUTPUT] /Users/murasawa/.vscode/extensions/connorshea.vscode-ruby-test-adapter-0.8.0/ruby/vscode/minitest/runner.rb:40:in `block in run'
[2021-01-20 09:38:34.564] [DEBUG] [CHILD PROCESS OUTPUT] /Users/murasawa/.vscode/extensions/connorshea.vscode-ruby-test-adapter-0.8.0/ruby/vscode/minitest/runner.rb:39:in `each'
[2021-01-20 09:38:34.564] [DEBUG] [CHILD PROCESS OUTPUT] /Users/murasawa/.vscode/extensions/connorshea.vscode-ruby-test-adapter-0.8.0/ruby/vscode/minitest/runner.rb:39:in `run'
[2021-01-20 09:38:34.564] [DEBUG] [CHILD PROCESS OUTPUT] /Users/murasawa/.vscode/extensions/connorshea.vscode-ruby-test-adapter-0.8.0/ruby/vscode/minitest.rb:36:in `run'
[2021-01-20 09:38:34.564] [DEBUG] [CHILD PROCESS OUTPUT] /Users/murasawa/.vscode/extensions/connorshea.vscode-ruby-test-adapter-0.8.0/ruby/vscode.rake:14:in `block (3 levels) in <top (required)>'
[2021-01-20 09:38:34.564] [DEBUG] [CHILD PROCESS OUTPUT] /Users/murasawa/.anyenv/envs/rbenv/versions/2.6.3/bin/bundle:23:in `load'
[2021-01-20 09:38:34.564] [DEBUG] [CHILD PROCESS OUTPUT] /Users/murasawa/.anyenv/envs/rbenv/versions/2.6.3/bin/bundle:23:in `<main>'
[2021-01-20 09:38:34.564] [DEBUG] [CHILD PROCESS OUTPUT] Tasks: TOP => vscode:minitest:run
[2021-01-20 09:38:34.564] [DEBUG] [CHILD PROCESS OUTPUT](See full trace by running task with --trace)
[2021-01-20 09:38:34.570] [INFO] Child process has exited. Sending test run finish event.

Conclusion

Gemfile


 gem 'minitest', '5.14.1'

Recommended Posts

When I run minitest in vscode's Ruby Test Explorer, NoMethodError: undefined method `klass'for ...
Breakpoint doesn't work when running Rails Minitest in Ruby Test Explorer
[Ruby] undefined method `dark?'occurs in rqr_code
[Ruby on Rails] NoMethodError undefined method `devise_for'error resolution
I got an error "undefined method` create'" in RSpec
When using Slim in Ruby on Rails, "undefined local variable or method` f'for "is displayed in form_with