Skip to content

[Repo Assist] fix: skip auto test discovery on workspace load when no test projects exist#2153

Draft
github-actions[bot] wants to merge 2 commits intomainfrom
repo-assist/fix-issue-2111-skip-discovery-no-test-projects-3dbb797eea14d4ba
Draft

[Repo Assist] fix: skip auto test discovery on workspace load when no test projects exist#2153
github-actions[bot] wants to merge 2 commits intomainfrom
repo-assist/fix-issue-2111-skip-discovery-no-test-projects-3dbb797eea14d4ba

Conversation

@github-actions
Copy link
Contributor

🤖 This PR was created by Repo Assist, an automated AI assistant.

Summary

Closes #2111

Prevents a spurious "No test projects found. Make sure you've restored your projects" error when opening a workspace that contains no F# test projects (e.g., an empty solution or a solution with only non-test projects).

Root Cause

When the workspace finishes loading and FSharp.TestExplorer.AutoDiscoverTestsOnLoad is true (the default), Ionide calls discoverTests_WithLanguageServer unconditionally. This causes FsAutoComplete to run its test discovery pipeline even when there are zero test projects in the workspace, which results in a misleading error notification.

Fix

In the workspaceLoaded handler for the language-server discovery path, check whether any test projects are present (using the same ProjectExt.isTestProject predicate used elsewhere in TestExplorer.fs) before initiating discovery. If no test projects exist, the call is silently skipped.

The on-demand refresh flow (via the refresh button or F# commands) is unaffected — it still runs discovery unconditionally, which is correct since the user explicitly requested it.

Trade-offs

  • If a workspace contains test projects that haven't yet been loaded when workspaceLoaded fires, they could be missed. However, Project.workspaceLoaded fires after projects are loaded, so Project.getLoaded() should be accurate at that point. This matches the same assumption made in the existing refreshHandler path at line 2109.
  • The auto-discovery warning "No tests discovered…" (line 1802) remains in place for workspaces that do have test projects but contain no tests — this is still useful feedback.

Test Status

Build succeeded (dotnet run --project build -- -t Build). No test failures introduced.

Generated by Repo Assist ·

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@346204513ecfa08b81566450d7d599556807389f

… exist

Fixes #2111

When a workspace is loaded and contains no test projects (e.g. a solution
with only non-test projects, or an empty solution), Ionide previously
attempted auto-discovery unconditionally, triggering a 'No test projects
found' error notification from FsAutoComplete even though this was
expected.

This change adds a guard in the workspaceLoaded handler so that
discoverTests_WithLanguageServer is only called when at least one test
project (identified by a Microsoft.NET.Test.Sdk or
Microsoft.TestPlatform.TestHost package reference) is present in the
loaded workspace.

The existing explicit refresh flow (via the refresh button or command) is
unaffected and still discovers tests on demand.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"No test projects found" error when opening any .NET project directory

0 participants