Skip to content

Commit a4c788c

Browse files
committed
Discover tests without building on initial workspace load
If they've never built their solution, then we won't be able to load tests until they restore anyway. If they have built their solution, we probably don't need to build it again. It's much faster to discover tests without the build and, unlike clicking the refresh button, there is a much smaller chance they're looking for missing test or otherwise solving a weird explorer state where we'd want fresh build artifacts.
1 parent 941edae commit a4c788c

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

src/Components/TestExplorer.fs

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,9 @@ module TestResultOutcome =
237237
| TestOutcomeDTO.Skipped -> TestResultOutcome.Skipped
238238
| TestOutcomeDTO.None -> TestResultOutcome.NotExecuted
239239
| TestOutcomeDTO.NotFound -> TestResultOutcome.NotExecuted
240-
| _ -> failwith $"Unknown value for TestOutcomeDTO: {outcomeDto}. The language server may have changed its possible values."
240+
| _ ->
241+
failwith
242+
$"Unknown value for TestOutcomeDTO: {outcomeDto}. The language server may have changed its possible values."
241243

242244

243245
type TestFrameworkId = string
@@ -1729,11 +1731,7 @@ module Interactions =
17291731
HasIncludeFilter = hasIncludeFilter
17301732
Tests = replaceProjectRootIfPresent tests })
17311733

1732-
let private discoverTests_WithLanguageServer
1733-
testItemFactory
1734-
(rootTestCollection: TestItemCollection)
1735-
tryGetLocation
1736-
=
1734+
let discoverTests_WithLanguageServer testItemFactory (rootTestCollection: TestItemCollection) tryGetLocation =
17371735
withProgress NoCancel
17381736
<| fun p progressCancelToken ->
17391737
promise {
@@ -2319,16 +2317,19 @@ let activate (context: ExtensionContext) =
23192317
let initialTests = trxTests workspaceProjects
23202318
initialTests |> Array.iter testController.items.add
23212319

2322-
let cancellationTokenSource = vscode.CancellationTokenSource.Create()
2323-
// NOTE: Trx results can be partial if the last test run was filtered, so also queue a refresh to make sure we discover all tests
2324-
Interactions.refreshTestList
2325-
testItemFactory
2326-
testController.items
2327-
tryGetLocation
2328-
makeTrxPath
2329-
useLegacyDotnetCliIntegration
2330-
cancellationTokenSource.token
2331-
|> Promise.start
2320+
let cancellationTokenSource = vscode.CancellationTokenSource.Create()
2321+
// NOTE: Trx results can be partial if the last test run was filtered, so also queue a refresh to make sure we discover all tests
2322+
Interactions.refreshTestList
2323+
testItemFactory
2324+
testController.items
2325+
tryGetLocation
2326+
makeTrxPath
2327+
useLegacyDotnetCliIntegration
2328+
cancellationTokenSource.token
2329+
|> Promise.start
2330+
else
2331+
Interactions.discoverTests_WithLanguageServer testItemFactory testController.items tryGetLocation
2332+
|> Promise.start
23322333

23332334
None)
23342335
|> unbox

0 commit comments

Comments
 (0)