Skip to content

extension/src/goTest: skip testdata directories in test discovery - #4074

Open
ChrisJr404 wants to merge 1 commit into
golang:masterfrom
ChrisJr404:goTest-skip-testdata
Open

extension/src/goTest: skip testdata directories in test discovery#4074
ChrisJr404 wants to merge 1 commit into
golang:masterfrom
ChrisJr404:goTest-skip-testdata

Conversation

@ChrisJr404

Copy link
Copy Markdown

The Test Explorer walks the workspace to discover _test.go files, but it
descended into testdata directories too. The go command treats testdata
as inert, so tests defined there aren't real and shouldn't appear in the
tree.

walk now skips directories named testdata, which keeps both walkWorkspaces
and walkPackages from descending into them. That covers discovery through
the tree, but a user can still open a _test.go file that lives under a
testdata directory directly, so processDocument returns early when the
document's path contains a testdata segment. This follows the approach
firelizzard18 outlined on the issue.

Added resolver tests for both paths: a testdata package is skipped during
module resolution, and a file opened from within testdata resolves no
tests.

Fixes #1854

The Test Explorer walks the workspace to discover _test.go files, but it
descended into testdata directories too. The go command treats testdata
as inert, so tests defined there aren't real and shouldn't appear in the
tree.

walk now skips directories named testdata, which keeps both walkWorkspaces
and walkPackages from descending into them. That covers discovery through
the tree, but a user can still open a _test.go file that lives under a
testdata directory directly, so processDocument returns early when the
document's path contains a testdata segment.

Added resolver tests for both paths: a testdata package is skipped during
module resolution, and a file opened from within testdata resolves no
tests.

Fixes golang#1854
@google-cla

google-cla Bot commented Aug 18, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

testExplorer: skip test files in testdata directory

1 participant