Shopify / Shopify/ruby-lsp

Support custom test commands

Open
#3,838 6 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement pinned
Dominant language
Ruby
Stars
2k
Forks
281
Avg merge
2h 14m
Merged PRs (30d)
6

Description

I have checked that this feature is not already implemented
  • This feature does not exist
Use case

The current LSP attempts to automatically determine the command to run tests using the Test Explorer, however this doesn't work for all scenarios. For example, Rails applications use bin/rails test out of the box.

The current commands generated by the LSP do not work for all codebases, so allowing developers to customize the test command would make the Test Explorer functionality more useful for all codebases.

Description

I would like to be able to customize the command used for the test explorer to run tests, for example bin/rails test

Implementation

In the Code Lens command creation, prefer to read from the extension configuration instead of the base command: https://github.com/Shopify/ruby-lsp/blob/main/lib/ruby_lsp/listeners/code_lens.rb#L210-L225

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in lib/ruby_lsp/listeners/code_lens.rb at the Code Lens command creation around lines 210-225, then trace how extension configuration is read. Verify that a configured test command such as bin/rails test is preferred over the generated base command when the Test Explorer runs tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby, vscode
Domain
testing, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.