Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix minitest spec code lens load path #2706

Merged
merged 2 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions lib/ruby_lsp/listeners/code_lens.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class CodeLens
"bundle exec ruby"
rescue Bundler::GemfileNotFound
"ruby"
end + " -Itest ",
end,
String,
)
ACCESS_MODIFIERS = T.let([:public, :private, :protected], T::Array[Symbol])
Expand Down Expand Up @@ -229,7 +229,10 @@ def add_test_code_lens(node, name:, command:, kind:, id: name)
).returns(String)
end
def generate_test_command(group_stack: [], spec_name: nil, method_name: nil)
command = BASE_COMMAND + T.must(@path)
command = BASE_COMMAND
command += " -Itest" if T.must(@path).include?("#{File::SEPARATOR}test#{File::SEPARATOR}")
command += " -Ispec" if T.must(@path).include?("#{File::SEPARATOR}spec#{File::SEPARATOR}")
command += " #{T.must(@path)}"
thomasmarshall marked this conversation as resolved.
Show resolved Hide resolved

case @global_state.test_library
when "minitest"
Expand Down
1 change: 1 addition & 0 deletions project-words
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ hostedtoolcache
importmap
indexables
ipairs
Ispec
Itest
ivar
Jaro
Expand Down

Large diffs are not rendered by default.

90 changes: 45 additions & 45 deletions test/expectations/code_lens/minitest_spec_tests.exp.json

Large diffs are not rendered by default.

54 changes: 27 additions & 27 deletions test/expectations/code_lens/minitest_tests.exp.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"arguments": [
"/fixtures/minitest_tests.rb",
"Test",
"bundle exec ruby -Itest /fixtures/minitest_tests.rb --name \"/^Test(#|::)/\"",
"bundle exec ruby /fixtures/minitest_tests.rb --name \"/^Test(#|::)/\"",
{
"start_line": 0,
"start_column": 0,
Expand Down Expand Up @@ -51,7 +51,7 @@
"arguments": [
"/fixtures/minitest_tests.rb",
"Test",
"bundle exec ruby -Itest /fixtures/minitest_tests.rb --name \"/^Test(#|::)/\"",
"bundle exec ruby /fixtures/minitest_tests.rb --name \"/^Test(#|::)/\"",
{
"start_line": 0,
"start_column": 0,
Expand Down Expand Up @@ -85,7 +85,7 @@
"arguments": [
"/fixtures/minitest_tests.rb",
"Test",
"bundle exec ruby -Itest /fixtures/minitest_tests.rb --name \"/^Test(#|::)/\"",
"bundle exec ruby /fixtures/minitest_tests.rb --name \"/^Test(#|::)/\"",
{
"start_line": 0,
"start_column": 0,
Expand Down Expand Up @@ -119,7 +119,7 @@
"arguments": [
"/fixtures/minitest_tests.rb",
"Test#test_public",
"bundle exec ruby -Itest /fixtures/minitest_tests.rb --name Test#test_public",
"bundle exec ruby /fixtures/minitest_tests.rb --name Test#test_public",
{
"start_line": 5,
"start_column": 2,
Expand Down Expand Up @@ -152,7 +152,7 @@
"arguments": [
"/fixtures/minitest_tests.rb",
"Test#test_public",
"bundle exec ruby -Itest /fixtures/minitest_tests.rb --name Test#test_public",
"bundle exec ruby /fixtures/minitest_tests.rb --name Test#test_public",
{
"start_line": 5,
"start_column": 2,
Expand Down Expand Up @@ -185,7 +185,7 @@
"arguments": [
"/fixtures/minitest_tests.rb",
"Test#test_public",
"bundle exec ruby -Itest /fixtures/minitest_tests.rb --name Test#test_public",
"bundle exec ruby /fixtures/minitest_tests.rb --name Test#test_public",
{
"start_line": 5,
"start_column": 2,
Expand Down Expand Up @@ -218,7 +218,7 @@
"arguments": [
"/fixtures/minitest_tests.rb",
"Test#test_public_command",
"bundle exec ruby -Itest /fixtures/minitest_tests.rb --name Test#test_public_command",
"bundle exec ruby /fixtures/minitest_tests.rb --name Test#test_public_command",
{
"start_line": 9,
"start_column": 9,
Expand Down Expand Up @@ -251,7 +251,7 @@
"arguments": [
"/fixtures/minitest_tests.rb",
"Test#test_public_command",
"bundle exec ruby -Itest /fixtures/minitest_tests.rb --name Test#test_public_command",
"bundle exec ruby /fixtures/minitest_tests.rb --name Test#test_public_command",
{
"start_line": 9,
"start_column": 9,
Expand Down Expand Up @@ -284,7 +284,7 @@
"arguments": [
"/fixtures/minitest_tests.rb",
"Test#test_public_command",
"bundle exec ruby -Itest /fixtures/minitest_tests.rb --name Test#test_public_command",
"bundle exec ruby /fixtures/minitest_tests.rb --name Test#test_public_command",
{
"start_line": 9,
"start_column": 9,
Expand Down Expand Up @@ -317,7 +317,7 @@
"arguments": [
"/fixtures/minitest_tests.rb",
"Test#test_another_public",
"bundle exec ruby -Itest /fixtures/minitest_tests.rb --name Test#test_another_public",
"bundle exec ruby /fixtures/minitest_tests.rb --name Test#test_another_public",
{
"start_line": 11,
"start_column": 9,
Expand Down Expand Up @@ -350,7 +350,7 @@
"arguments": [
"/fixtures/minitest_tests.rb",
"Test#test_another_public",
"bundle exec ruby -Itest /fixtures/minitest_tests.rb --name Test#test_another_public",
"bundle exec ruby /fixtures/minitest_tests.rb --name Test#test_another_public",
{
"start_line": 11,
"start_column": 9,
Expand Down Expand Up @@ -383,7 +383,7 @@
"arguments": [
"/fixtures/minitest_tests.rb",
"Test#test_another_public",
"bundle exec ruby -Itest /fixtures/minitest_tests.rb --name Test#test_another_public",
"bundle exec ruby /fixtures/minitest_tests.rb --name Test#test_another_public",
{
"start_line": 11,
"start_column": 9,
Expand Down Expand Up @@ -416,7 +416,7 @@
"arguments": [
"/fixtures/minitest_tests.rb",
"Test#test_public_vcall",
"bundle exec ruby -Itest /fixtures/minitest_tests.rb --name Test#test_public_vcall",
"bundle exec ruby /fixtures/minitest_tests.rb --name Test#test_public_vcall",
{
"start_line": 17,
"start_column": 2,
Expand Down Expand Up @@ -449,7 +449,7 @@
"arguments": [
"/fixtures/minitest_tests.rb",
"Test#test_public_vcall",
"bundle exec ruby -Itest /fixtures/minitest_tests.rb --name Test#test_public_vcall",
"bundle exec ruby /fixtures/minitest_tests.rb --name Test#test_public_vcall",
{
"start_line": 17,
"start_column": 2,
Expand Down Expand Up @@ -482,7 +482,7 @@
"arguments": [
"/fixtures/minitest_tests.rb",
"Test#test_public_vcall",
"bundle exec ruby -Itest /fixtures/minitest_tests.rb --name Test#test_public_vcall",
"bundle exec ruby /fixtures/minitest_tests.rb --name Test#test_public_vcall",
{
"start_line": 17,
"start_column": 2,
Expand Down Expand Up @@ -515,7 +515,7 @@
"arguments": [
"/fixtures/minitest_tests.rb",
"Test#test_with_q?",
"bundle exec ruby -Itest /fixtures/minitest_tests.rb --name Test#test_with_q\\?",
"bundle exec ruby /fixtures/minitest_tests.rb --name Test#test_with_q\\?",
{
"start_line": 19,
"start_column": 2,
Expand Down Expand Up @@ -548,7 +548,7 @@
"arguments": [
"/fixtures/minitest_tests.rb",
"Test#test_with_q?",
"bundle exec ruby -Itest /fixtures/minitest_tests.rb --name Test#test_with_q\\?",
"bundle exec ruby /fixtures/minitest_tests.rb --name Test#test_with_q\\?",
{
"start_line": 19,
"start_column": 2,
Expand Down Expand Up @@ -581,7 +581,7 @@
"arguments": [
"/fixtures/minitest_tests.rb",
"Test#test_with_q?",
"bundle exec ruby -Itest /fixtures/minitest_tests.rb --name Test#test_with_q\\?",
"bundle exec ruby /fixtures/minitest_tests.rb --name Test#test_with_q\\?",
{
"start_line": 19,
"start_column": 2,
Expand Down Expand Up @@ -614,7 +614,7 @@
"arguments": [
"/fixtures/minitest_tests.rb",
"AnotherTest",
"bundle exec ruby -Itest /fixtures/minitest_tests.rb --name \"/^AnotherTest(#|::)/\"",
"bundle exec ruby /fixtures/minitest_tests.rb --name \"/^AnotherTest(#|::)/\"",
{
"start_line": 24,
"start_column": 0,
Expand Down Expand Up @@ -648,7 +648,7 @@
"arguments": [
"/fixtures/minitest_tests.rb",
"AnotherTest",
"bundle exec ruby -Itest /fixtures/minitest_tests.rb --name \"/^AnotherTest(#|::)/\"",
"bundle exec ruby /fixtures/minitest_tests.rb --name \"/^AnotherTest(#|::)/\"",
{
"start_line": 24,
"start_column": 0,
Expand Down Expand Up @@ -682,7 +682,7 @@
"arguments": [
"/fixtures/minitest_tests.rb",
"AnotherTest",
"bundle exec ruby -Itest /fixtures/minitest_tests.rb --name \"/^AnotherTest(#|::)/\"",
"bundle exec ruby /fixtures/minitest_tests.rb --name \"/^AnotherTest(#|::)/\"",
{
"start_line": 24,
"start_column": 0,
Expand Down Expand Up @@ -716,7 +716,7 @@
"arguments": [
"/fixtures/minitest_tests.rb",
"AnotherTest#test_public",
"bundle exec ruby -Itest /fixtures/minitest_tests.rb --name AnotherTest#test_public",
"bundle exec ruby /fixtures/minitest_tests.rb --name AnotherTest#test_public",
{
"start_line": 25,
"start_column": 2,
Expand Down Expand Up @@ -749,7 +749,7 @@
"arguments": [
"/fixtures/minitest_tests.rb",
"AnotherTest#test_public",
"bundle exec ruby -Itest /fixtures/minitest_tests.rb --name AnotherTest#test_public",
"bundle exec ruby /fixtures/minitest_tests.rb --name AnotherTest#test_public",
{
"start_line": 25,
"start_column": 2,
Expand Down Expand Up @@ -782,7 +782,7 @@
"arguments": [
"/fixtures/minitest_tests.rb",
"AnotherTest#test_public",
"bundle exec ruby -Itest /fixtures/minitest_tests.rb --name AnotherTest#test_public",
"bundle exec ruby /fixtures/minitest_tests.rb --name AnotherTest#test_public",
{
"start_line": 25,
"start_column": 2,
Expand Down Expand Up @@ -815,7 +815,7 @@
"arguments": [
"/fixtures/minitest_tests.rb",
"AnotherTest#test_public_2",
"bundle exec ruby -Itest /fixtures/minitest_tests.rb --name AnotherTest#test_public_2",
"bundle exec ruby /fixtures/minitest_tests.rb --name AnotherTest#test_public_2",
{
"start_line": 31,
"start_column": 2,
Expand Down Expand Up @@ -848,7 +848,7 @@
"arguments": [
"/fixtures/minitest_tests.rb",
"AnotherTest#test_public_2",
"bundle exec ruby -Itest /fixtures/minitest_tests.rb --name AnotherTest#test_public_2",
"bundle exec ruby /fixtures/minitest_tests.rb --name AnotherTest#test_public_2",
{
"start_line": 31,
"start_column": 2,
Expand Down Expand Up @@ -881,7 +881,7 @@
"arguments": [
"/fixtures/minitest_tests.rb",
"AnotherTest#test_public_2",
"bundle exec ruby -Itest /fixtures/minitest_tests.rb --name AnotherTest#test_public_2",
"bundle exec ruby /fixtures/minitest_tests.rb --name AnotherTest#test_public_2",
{
"start_line": 31,
"start_column": 2,
Expand Down
Loading
Loading