Skip to content

Commit

Permalink
Use File.fnmatch? to select test directory
Browse files Browse the repository at this point in the history
Co-authored-by: Vinicius Stock <[email protected]>
  • Loading branch information
thomasmarshall and vinistock authored Nov 26, 2024
1 parent 12f70f0 commit 3b13322
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/ruby_lsp/listeners/code_lens.rb
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,11 @@ 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)
path = 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)}"
command += " -Itest" if File.fnmatch?("**/test/**/*", path, File::FNM_PATHNAME)
command += " -Ispec" if File.fnmatch?("**/spec/**/*", path, File::FNM_PATHNAME)
command += " #{path}"

case @global_state.test_library
when "minitest"
Expand Down

0 comments on commit 3b13322

Please sign in to comment.