ruby-lsp icon indicating copy to clipboard operation
ruby-lsp copied to clipboard

Test discovery broke in recent release?

Open baelter opened this issue 3 months ago • 2 comments

Description

Ruby LSP Information

VS Code Version

1.104.2

Ruby LSP Extension Version

0.9.32

Ruby LSP Server Version

0.26.1

Ruby LSP Add-ons

  • RuboCop (unknown)

Ruby Version

3.4.4

Ruby Version Manager

rbenv

Installed Extensions

Click to expand
  • EditorConfig (0.17.4)
  • RunOnSave (0.2.7)
  • ansible (25.9.0)
  • auto-add-brackets (0.12.2)
  • ayu (1.0.5)
  • code-spell-checker (4.2.6)
  • codesnap (1.3.4)
  • copilot (1.372.0)
  • copilot-chat (0.31.2)
  • crystal-ameba (0.2.1)
  • crystal-lang (0.9.7)
  • debugpy (2025.10.0)
  • dotenv (1.0.1)
  • errorlens (3.26.0)
  • haml (1.4.1)
  • haml-lint (0.2.1)
  • isort (2025.0.0)
  • jinjahtml (0.20.0)
  • makefile-tools (0.12.17)
  • markdown-mermaid (1.29.0)
  • mermaid-markdown-syntax-highlighting (1.7.4)
  • prettier-vscode (11.0.0)
  • python (2025.14.0)
  • rainbow-csv (3.22.0)
  • remote-containers (0.427.0)
  • ruby-extensions-pack (0.1.13)
  • ruby-lsp (0.9.32)
  • shellcheck (0.38.3)
  • sorbet-vscode-extension (0.3.45)
  • systemd-unit-file (1.0.8)
  • terraform (2.37.2)
  • todo-tree (0.0.226)
  • vscode-eslint (3.0.16)
  • vscode-github-actions (0.27.2)
  • vscode-html-css (2.0.13)
  • vscode-lldb (1.11.5)
  • vscode-markdownlint (0.60.0)
  • vscode-pull-request-github (0.118.1)
  • vscode-pylance (2025.8.2)
  • vscode-sort-json (1.20.0)
  • vscode-speech (0.16.0)
  • vscode-template-literal-editor (0.10.0)
  • vscode-yaml (1.19.0)
  • vsliveshare (1.0.5959)
  • workspacesort (1.6.2)

Ruby LSP Settings

Click to expand
Workspace
{}
User
{
  "enabledFeatures": {
    "codeActions": true,
    "diagnostics": true,
    "documentHighlights": true,
    "documentLink": true,
    "documentSymbols": true,
    "foldingRanges": true,
    "formatting": true,
    "hover": true,
    "inlayHint": true,
    "onTypeFormatting": true,
    "selectionRanges": true,
    "semanticHighlighting": true,
    "completion": true,
    "codeLens": true,
    "definition": true,
    "workspaceSymbol": true,
    "signatureHelp": true,
    "typeHierarchy": true
  },
  "featuresConfiguration": {},
  "addonSettings": {},
  "rubyVersionManager": {
    "identifier": "rbenv"
  },
  "customRubyCommand": "",
  "formatter": "rubocop_internal",
  "linters": null,
  "bundleGemfile": "",
  "testTimeout": 30,
  "branch": "",
  "pullDiagnosticsOn": "both",
  "useBundlerCompose": false,
  "bypassTypechecker": false,
  "rubyExecutablePath": "",
  "indexing": {},
  "erbSupport": true,
  "featureFlags": {
    "fullTestDiscovery": true
  },
  "sigOpacityLevel": "1"
}

Reproduction steps

  1. Start the Ruby LSP using vscode
  2. Open a Ruby test file
  3. Try to run the test via the test explorer play button
  4. See unexpected behavior

Code snippet or error message

Image

baelter avatar Sep 29 '25 07:09 baelter

@baelter I had/have a similar issue. I think if you go into the VSCode testing tab and click refresh it works.

My issue is slightly different though because I'm clicking play from a file itself. It seems like there are two components at odds with each other here:

  1. Whatever looks at a current file
  2. Whatever discovers tests asynchronously

When I click "run test" on a current file, it seems like 1 is registering the tests (hence the buttons existing), but 2 is not. A simple "refresh" of the actual test discovery seems to solve this.

Unclear to me why they get out of the sync but this is currently pervasive at my company

kassemsandarusi avatar Oct 27 '25 15:10 kassemsandarusi

Thank you for reporting this issue.

The only way I managed to reproduce this issue was by turning off file watchers on VS Code "files.watcherExclude": { "**/test/**": true }.

With the test files excluded from watching, the extension doesn't get notified when a file was changed. The server and the client get out of sync, triggering the issue. This is why clicking refresh works, as it doesn't depend on file watchers - it indexes test files from scratch. This problem is easy to verify by renaming a test example, while having test file watcher exclusions, and seeing that the name doesn't get updated automatically in test explorer.

Do you happen to have any exclusion configured, or any other file watcher settings?

alexcrocha avatar Dec 02 '25 21:12 alexcrocha