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

Added Default User Shell when executing Commands #131

Open brand-it opened 7 months ago

brand-it commented 7 months ago

I was playing around with this extension, and for the most part, it works great. However, I ran into one issue: it did not use my default shell defined within the command line. This is a problem as I have some environment variables and path info that are not generally accessible to my other bash shells. This resulted in many please set RAILS_MASTER_KEY errors, which are easy to fix. However, it would not be nice to use my default shell when it detected it or others' default shells as this could save a lot of pain with differences in pathing info.

This concept was pulled from Ruby LSP so can't take credit for the code.

[2023-12-19 22:54:55.246] [INFO] Running dry-run of RSpec test suite with the following command: /opt/homebrew/bin/fish -ic "bundle exec rspec --pattern './spec//**{,/*/**}/*_test.rb,./spec//**{,/*/**}/test_*.rb,./spec//**{,/*/**}/*_spec.rb'       --require /Users/brandit/apps/vscode-ruby-test-adapter/custom_formatter.rb       --format CustomFormatter       --order defined       --dry-run"

Above is the output it generates when I change the default shell to fishshell. This also works for zsh and bash.

Some screenshots showing it working for rspec. Screenshot 2023-12-19 at 3 19 34 PM

[2023-12-19 23:18:49.077] [INFO] Running command: /opt/homebrew/bin/fish -ic "bundle exec rspec --require /Users/brandit/apps/vscode-ruby-test-adapter/custom_formatter.rb --format CustomFormatter '/Users/brandit/apps/test/spec/testing_spec.rb:10'"