Shopify / Shopify/ruby-lsp

Test path pattern (TEST_PATH_PATTERN) discovers tests from .bundle/gems and vendor/bundle

Open
#3,949 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description

Confirmed as a bug by @vinistock on Ruby DX Discord.

Ruby LSP Information
VS Code Version

1.108.2

Ruby LSP Extension Version

0.10.0

Ruby LSP Server Version

0.26.5

Ruby LSP Add-ons
  • Standard Ruby (unknown)
  • Ruby LSP RSpec (0.26.5)
  • Ruby LSP Rails (0.4.8)
  • RuboCop (1.82.1)
Ruby Version

3.4.7

Ruby Version Manager

rbenv

Installed Extensions
Click to expand
  • copilot-chat (0.36.2)
  • openapi-preview (2.3.1)
  • rainbow-csv (3.24.1)
  • remote-containers (0.442.0)
  • ruby-lsp (0.10.0)
  • ruby-lsp-go-to-spec (0.1.3)
  • ruby-symbols (0.1.8)
  • vim (1.32.4)
  • vscode-containers (2.4.1)
  • vscode-docker (2.0.0)
  • vscode-pdf (0.1.6)
  • vscode-standard-ruby (0.0.16)
  • vscode-xml (0.29.0)
  • vscode-xsd-treeview (0.0.5)
Ruby LSP Settings
Click to expand
Workspace
{
  "addonSettings": {
    "Ruby LSP RSpec": {
      "rspecCommand": "bin/rspec"
    }
  },
  "rubyVersionManager": "rbenv",
  "indexing": {
    "excludedPatterns": [
      ".bundle/**/*"
    ]
  },
  "featureFlags": {
    "fullTestDiscovery": true
  }
}
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": {
    "Ruby LSP RSpec": {
      "rspecCommand": "bin/rspec"
    }
  },
  "rubyVersionManager": "rbenv",
  "customRubyCommand": "",
  "formatter": "auto",
  "linters": null,
  "bundleGemfile": "",
  "testTimeout": 30,
  "branch": "",
  "pullDiagnosticsOn": "both",
  "useBundlerCompose": false,
  "bypassTypechecker": false,
  "rubyExecutablePath": "",
  "indexing": {
    "excludedPatterns": [
      ".bundle/**/*"
    ]
  },
  "erbSupport": true,
  "featureFlags": {
    "fullTestDiscovery": true
  },
  "sigOpacityLevel": "1"
}
Reproduction steps
  1. bundle install --path .bundle/gems or bundle install --deployment to install gems in the local repository. Any path used could encounter this problem, but these two are common conventions across ruby projects.
  2. Using VSCode as an IDE, navigate to the "testing" sidebar.
  3. Click the Refresh tests icon at the top (looks like refresh)

Expected: only my ${workspaceRoot}/spec directory is discovered, full of rspec tests.
Current: Tests from gems installed in .bundle/gems or vendor/bundle are also discovered.

Example showing .bundle/gems:
Image

Suggested resolution

Option A: Make test patterns configurable (include and exclude). Supply good defaults.
Option B: Ensure .bundle (and all subdirectories) and vendor/bundle and all subdirectories are hardcoded exclusions, much like the existing TEST_PATH_PATTERN functions.

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 with the TEST_PATH_PATTERN functions responsible for full test discovery and reproduce the issue with gems installed under .bundle/gems or vendor/bundle. Confirm that discovery excludes those directories while still finding the workspace's spec tests, then run the relevant test-discovery checks if present.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
developer-experience, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.