Skip to content

Commit 3e3dab0

Browse files
authored
Remove RUBYOPT from ruby-lsp-test-exec (#3673)
1 parent 8cd57cd commit 3e3dab0

File tree

3 files changed

+9
-26
lines changed

3 files changed

+9
-26
lines changed

exe/ruby-lsp-test-exec

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,6 @@
11
#!/usr/bin/env ruby
22
# frozen_string_literal: true
33

4-
# Append to RUBYOPT the necessary requires to hook our custom test reporters so that results are automatically
5-
# reflected in the test explorer
6-
rubyopt = [
7-
*ENV["RUBYOPT"],
8-
"-rbundler/setup",
9-
"-r#{File.expand_path("../lib/ruby_lsp/test_reporters/minitest_reporter", __dir__)}",
10-
"-r#{File.expand_path("../lib/ruby_lsp/test_reporters/test_unit_reporter", __dir__)}",
11-
].join(" ")
12-
13-
# Replace this process with whatever command was passed. We only want to set RUBYOPT.
14-
# The way you use this executable is by prefixing your test command with `ruby-lsp-test-exec`, like so:
15-
# ruby-lsp-test-exec bundle exec ruby -Itest test/example_test.rb
16-
# ruby-lsp-test-exec bundle exec ruby -Ispec spec/example_spec.rb
17-
# ruby-lsp-test-exec bundle exec rspec spec/example_spec.rb
18-
exec({ "RUBYOPT" => rubyopt }, *ARGV)
4+
# This executable will be removed thanks to the changes in https://github.com/Shopify/ruby-lsp/pull/3661.
5+
# Remove this a few months after extension updates have rolled out
6+
exec(*ARGV)

jekyll/test_explorer.markdown

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,16 +119,13 @@ items accept metadata. This scenario will not be supported by the Ruby LSP.
119119

120120
## Connecting terminal tests to the explorer
121121

122-
When running tests in the terminal through a code lens or test explorer, the Ruby LSP uses the `ruby-lsp-test-exec`
123-
executable, which hooks the test run to the extension so that we can show test results in the explorer.
124-
125-
By running tests with this executable, even manually written test commands will also have their results reported
126-
to the test explorer. For example, all of the following will report test statuses to the extension:
122+
When running tests in the terminal through a code lens or test explorer, the Ruby LSP and add-ons will hook up the
123+
execution commands with the expected reporters using the `-r` argument for `ruby`. You can manually hook up execution
124+
by adding the same.
127125

128126
```shell
129-
ruby-lsp-test-exec bundle exec ruby -Itest test/example_test.rb
130-
ruby-lsp-test-exec bundle exec ruby -Ispec spec/example_spec.rb
131-
ruby-lsp-test-exec bundle exec rspec spec/example_spec.rb
127+
bundle exec ruby -r/path/to/ruby-lsp/reporter -Itest test/example_test.rb
128+
bundle exec ruby -r/path/to/ruby-lsp/reporter -Ispec spec/example_spec.rb
132129
```
133130

134131
## Customization

vscode/src/streamingRunner.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,7 @@ export class StreamingRunner implements vscode.Disposable {
148148
this.terminals.set(name, terminal);
149149

150150
terminal.show();
151-
const exec =
152-
path.basename(cwd) === "ruby-lsp" && os.platform() !== "win32" ? "exe/ruby-lsp-test-exec" : "ruby-lsp-test-exec";
153-
terminal.sendText(`${exec} ${command}`);
151+
terminal.sendText(command);
154152
}
155153

156154
// Spawns the test process and redirects any stdout or stderr output to the test run output

0 commit comments

Comments
 (0)