connorshea / vscode-ruby-test-adapter

A Ruby test adapter extension for the VS Code Test Explorer
https://marketplace.visualstudio.com/items?itemName=connorshea.vscode-ruby-test-adapter
MIT License
83 stars 50 forks source link

Command failed: bundle exec rails test -R $EXT_DIR vscode:minitest:list #82

Open Signum opened 3 years ago

Signum commented 3 years ago

Your environment

Expected behavior

See the list of tests.

Actual behavior

Error message on the bottom right:

Command failed: bundle exec rails test -R $EXT_DIR vscode:minitest:list /home/chaas/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bootsnap-1.7.7/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:34:in require': cannot load such file -- rspec (LoadError) from /home/chaas/.vscode/extensions/connorshea.vscode-ruby-test-adapter-0.9.0/ruby/rspecs/unit_test.rb:1:in

' from /home/chaas/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bootsnap-1.7.7/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in require' from /home/chaas/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bootsnap-1.7.7/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:inblock in require_with_bootsnap_lfi' from /home/chaas/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bootsnap-1.7.7/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register' from /home/chaas/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bootsnap-1.7.7/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22...

…and…

Ruby Test Explorer failed to find a Minitest test suite. Make sure Minitest is installed and your configured Minitest command is correct.

Trying vscode:minitest:list in the shell

EXT_DIR=~/.vscode/extensions/connorshea.vscode-ruby-test-adapter-0.9.0/ruby bundle exec rake -R $EXT_DIR vscode:minitest:list rake aborted! KeyError: key not found: "TESTS_PATTERN" /home/chaas/.vscode/extensions/connorshea.vscode-ruby-test-adapter-0.9.0/ruby/vscode/minitest/tests.rb:25:in fetch' /home/chaas/.vscode/extensions/connorshea.vscode-ruby-test-adapter-0.9.0/ruby/vscode/minitest/tests.rb:25:inload_files' /home/chaas/.vscode/extensions/connorshea.vscode-ruby-test-adapter-0.9.0/ruby/vscode/minitest/tests.rb:8:in all' /home/chaas/.vscode/extensions/connorshea.vscode-ruby-test-adapter-0.9.0/ruby/vscode/minitest.rb:25:inlist' /home/chaas/.vscode/extensions/connorshea.vscode-ruby-test-adapter-0.9.0/ruby/vscode.rake:8:in block (3 levels) in <main>' /home/chaas/.rbenv/versions/2.6.6/bin/bundle:23:inload' /home/chaas/.rbenv/versions/2.6.6/bin/bundle:23:in `

' Tasks: TOP => vscode:minitest:list (See full trace by running task with --trace)

Trying to set TESTS_PATTERN into the environment before starting VScode

export EXT_DIR=~/.vscode/extensions/connorshea.vscode-ruby-test-adapter-0.9.0/ruby ; export TESTS_PATTERN='*_test.rb' rake -R $EXT_DIR vscode:minitest:list

START_OF_TEST_JSON{"version":"5.14.4","examples":[{"description":"sanity","full_description":"sanity","file_path":"./test/helpers/logs_helper_test.rb","full_path":"/home/chaas/projekte/debshots2/test/helpers/logs_helper_test.rb","line_number":4,"klass":"LogsHelperTest","method":"test_sanity","runnable":"LogsHelperTest","id":"./test/helpers/logs_helper_test.rb[4]"},{"description":"should detect the proper order of package versions","full_description":"should detect the proper order of package versions","file_path":"./test/lib/deb_importer_test.rb","full_path":"/home/chaas/projekte/debshots2/test/lib/deb_importer_test.rb","line_number":11,"klass":"PackagesHelperTest","method":"test_should_detect_the_proper_order_of_package_versions","runnable":"PackagesHelperTest","id":"./test/lib/deb_importer_test.rb[11]"},{"description":"should split version files into epoch, upstream and revision","full_description":"should split version files into epoch, upstream and revision","file_path":"./test/lib/deb_importer_test.rb","full_path":"/home/chaas/projekte/debshots2/test/lib/deb_importer_test.rb","line_number":21,"klass":"PackagesHelperTest","method":"test_should_split_version_files_into_epoch,_upstream_and_revision","runnable":"PackagesHelperTest","id":"./test/lib/deb_importer_test.rb[21]"},{"description":"should be able to parse local Debian repository test files","full_description":"should be able to parse local Debian repository test files","file_path":"./test/lib/deb_importer_test.rb","full_path":"/home/chaas/projekte/debshots2/test/lib/deb_importer_test.rb","line_number":48,"klass":"PackagesHelperTest","method":"test_should_be_able_to_parse_local_Debian_repository_test_files","runnable":"PackagesHelperTest","id":"./test/lib/deb_importer_test.rb[48]"},{"description":"visit home page","full_description":"visit home page","file_path":"./test/integration/homepage_test.rb","full_path":"/home/chaas/projekte/debshots2/test/integration/homepage_test.rb","line_number":8,"klass":"AdvancedTest","method":"test_visit_home_page","runnable":"AdvancedTest","id":"./test/integration/homepage_test.rb[8]"},{"description":"valid","full_description":"valid","file_path":"./test/models/user_test.rb","full_path":"/home/chaas/projekte/debshots2/test/models/user_test.rb","line_number":8,"klass":"UserTest","method":"test_valid","runnable":"UserTest","id":"./test/models/user_test.rb[8]"},{"description":"user can see home page","full_description":"user can see home page","file_path":"./test/system/browses_test.rb","full_path":"/home/chaas/projekte/debshots2/test/system/browses_test.rb","line_number":10,"klass":"BrowsesTest","method":"test_user_can_see_home_page","runnable":"BrowsesTest","id":"./test/system/browses_test.rb[10]"},{"description":"user can browse packages","full_description":"user can browse packages","file_path":"./test/system/browses_test.rb","full_path":"/home/chaas/projekte/debshots2/test/system/browses_test.rb","line_number":15,"klass":"BrowsesTest","method":"test_user_can_browse_packages","runnable":"BrowsesTest","id":"./test/system/browses_test.rb[15]"},{"description":"upload broken screenshot anonymously and get error message","full_description":"upload broken screenshot anonymously and get error message","file_path":"./test/system/uploads_test.rb","full_path":"/home/chaas/projekte/debshots2/test/system/uploads_test.rb","line_number":4,"klass":"UploadsTest","method":"test_upload_broken_screenshot_anonymously_and_get_error_message","runnable":"UploadsTest","id":"./test/system/uploads_test.rb[4]"},{"description":"upload png screenshot anonymously and await moderation","full_description":"upload png screenshot anonymously and await moderation","file_path":"./test/system/uploads_test.rb","full_path":"/home/chaas/projekte/debshots2/test/system/uploads_test.rb","line_number":13,"klass":"UploadsTest","method":"test_upload_png_screenshot_anonymously_and_await_moderation","runnable":"UploadsTest","id":"./test/system/uploads_test.rb[13]"},{"description":"upload png screenshot as moderator and expect auto-approval","full_description":"upload png screenshot as moderator and expect auto-approval","file_path":"./test/system/uploads_test.rb","full_path":"/home/chaas/projekte/debshots2/test/system/uploads_test.rb","line_number":59,"klass":"UploadsTest","method":"test_upload_png_screenshot_as_moderator_and_expect_auto-approval","runnable":"UploadsTest","id":"./test/system/uploads_test.rb[59]"},{"description":"go to login page","full_description":"go to login page","file_path":"./test/system/users_test.rb","full_path":"/home/chaas/projekte/debshots2/test/system/users_test.rb","line_number":4,"klass":"UsersTest","method":"test_go_to_login_page","runnable":"UsersTest","id":"./test/system/users_test.rb[4]"}]}END_OF_TEST_JSON

Running rake test works

ake test Started with run options --seed 21853 […] Finished in 0.11691s 6 tests, 30 assertions, 0 failures, 0 errors, 0 skips

awardreforge commented 2 years ago

anyone know how to properly set this up with docker tried to use docker-compose exec web rspec as the command and receiving issue

Running dry-run of RSpec test suite with the following command: docker-compose exec web rspec --pattern './spec//**/*_test.rb,./spec//**/test_*.rb,./spec//**/*_spec.rb' --require /Users/wardwinningdev/.vscode/extensions/connorshea.vscode-ruby-test-adapter-0.9.0/custom_formatter.rb --format CustomFormatter --order defined --dry-run [2022-05-13 20:07:52.333] [ERROR] Error while finding RSpec test suite: Command failed: docker-compose exec web rspec --pattern './spec//**/*_test.rb,./spec//**/test_*.rb,./spec//**/*_spec.rb' --require /Users/wardwinningdev/.vscode/extensions/connorshea.vscode-ruby-test-adapter-0.9.0/custom_formatter.rb --format CustomFormatter --order defined --dry-run the input device is not a TTY

misner commented 2 years ago

@Signum @awardreforge Running into the exact same issue and error message as you when using VS code with github codespace. Have you found a solution (Rails7/codespace with docker and devcontainer-dockerfile/Rails minitest)? if not, what tool did you fall back on to get test explorer features?