Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test explorer stability: Use test results as main truth source for explorer #1874

Merged
merged 40 commits into from
Aug 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
425764d
Fix duration parse error on run all
farlee2121 May 2, 2023
fcff548
Display test hierarchy from trx
farlee2121 May 4, 2023
607d328
Run tests from trx
farlee2121 May 5, 2023
2adb235
Map code locations to test tree
farlee2121 May 9, 2023
0077521
Discover tests if no trx exists
farlee2121 May 10, 2023
d43615c
Preserve test locations on refresh
farlee2121 May 10, 2023
3614b5d
Refactoring to centralize test creation quirks
farlee2121 May 12, 2023
8fcc22d
Merge tests updates from code
farlee2121 May 13, 2023
1926480
Refactor Test Item / result pairing to higher level
farlee2121 May 14, 2023
fb8eea1
Update test tree based on test results
farlee2121 May 14, 2023
5330dc4
Reduce scope of helper types
farlee2121 May 14, 2023
3fac404
Simplify test handler
farlee2121 May 14, 2023
4b8587b
Fix test explorer shuffle during location discovery
farlee2121 May 15, 2023
d0f2627
Generalize test hierarchy builder
farlee2121 May 15, 2023
f0a0f98
Support nested class hierarchies
farlee2121 May 15, 2023
c3996ad
Clarify signatures with type aliases
farlee2121 May 16, 2023
13cde47
Change filters to balance speed and discovery
farlee2121 May 16, 2023
3c1cf86
Write test console output to Test Result log.
farlee2121 May 16, 2023
4261a47
Stablize initial test explorer discovery
farlee2121 Jun 15, 2023
72428a2
Fix resource starvation for solutions with many projects
farlee2121 Jun 16, 2023
d4e8ba7
Add constrained promise parallelism
farlee2121 Jun 16, 2023
b7d0d25
Fix small collection errors in executeWithMaxParallel
farlee2121 Jun 19, 2023
e55775c
Improve progress reporting during test discovery
farlee2121 Jun 20, 2023
765b710
Refactor trx path decision to higher level
farlee2121 Jun 20, 2023
5714bf4
Move test results to extension storage folder
farlee2121 Jun 20, 2023
e4b0026
Guide user if no tests found in test projects
farlee2121 Jul 3, 2023
01a70cc
Discover tests using --list-only
farlee2121 Jun 20, 2023
80580fb
Run tests and test discovery against a single target framework
farlee2121 Jul 4, 2023
8e9e4f0
Partition tests by project
farlee2121 Jul 4, 2023
64d0ab7
Add target framework to project test items
farlee2121 Jul 5, 2023
7b45b7b
Preserve trailing space in test names using list discovery
farlee2121 Jul 5, 2023
a411c12
Ask user to restore before test discovery
farlee2121 Jul 7, 2023
d279a97
Improve error reporting during test discovery
farlee2121 Jul 9, 2023
95a2b78
Limit parallel test project execution
farlee2121 Aug 3, 2023
6bbc1a4
Linear build when running tests & centralize enqueue
farlee2121 Aug 3, 2023
6567b12
Respect cancel tokens in explorer
farlee2121 Aug 3, 2023
88c642d
Clarify implicit test framework property
farlee2121 Aug 8, 2023
e882c87
Fix NUnit filters with spaces when code loads before discovery
farlee2121 Aug 8, 2023
61e938c
Merge branch 'main' into test-explorer-stability
baronfel Aug 19, 2023
538f8c6
Merge branch 'main' into test-explorer-stability
baronfel Aug 19, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion release/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1707,6 +1707,12 @@
}
]
},
"viewsWelcome": [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a really great idea!

{
"view": "testing",
"contents": "Build your projects then refresh this explorer to discover F# and .NET tests"
}
],
"viewsContainers": {
"activitybar": [
{
Expand Down Expand Up @@ -1748,4 +1754,4 @@
"url": "https://github.com/ionide/ionide-vscode-fsharp.git"
},
"version": "7.8.5"
}
}
73 changes: 73 additions & 0 deletions src/Components/MSBuild.fs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,79 @@ module MSBuild =
| Ok msbuild -> Promise.lift msbuild
| Error msg -> Promise.reject (exn msg))

let invokeMSBuildWithCancel project target (cancellationToken: CancellationToken) =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: for follow-up we should see if invokeMSBuildWithCancel and invokeMSBuild can be unfied.

Copy link
Contributor Author

@farlee2121 farlee2121 Aug 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes. I forgot to follow up with that.
Opening a PR
EDIT: the PR


if cancellationToken.isCancellationRequested then
promise { return { Code = None; Signal = Some "SIGINT" } }
else
let autoshow =
let cfg = workspace.getConfiguration ()
cfg.get ("FSharp.msbuildAutoshow", false)

let command = [ project; $"/t:%s{target}" ]

let executeWithHost () =
promise {
let! msbuildPath = dotnetBinary ()
let cmd = ResizeArray("msbuild" :: command)
logger.Info("invoking msbuild from %s on %s for target %s", msbuildPath, project, target)

if autoshow then
outputChannel.show (?preserveFocus = None)

let childProcess = Process.spawnWithNotification msbuildPath cmd outputChannel

cancellationToken.onCancellationRequested.Invoke(fun _ ->
if (childProcess.connected) then
childProcess.kill ("SIGINT")

None)
|> ignore

return! childProcess |> Process.toPromise
}

let progressOpts = createEmpty<ProgressOptions>
progressOpts.location <- U2.Case1 ProgressLocation.Window

window.withProgress (
progressOpts,
(fun p ctok ->
promise {
let pm =
{| message = Some $"Running MSBuild '{target}' target on '{project}'"
increment = None |}

p.report pm
let! response = executeWithHost ()

match response.Code with
| Some 0 ->
p.report (
{| message = Some "MSBuild completed successfully"
increment = None |}
)

return response
| Some code ->
p.report (
{| message = Some $"MSBuild failed with code %d{code}"
increment = None |}
)

return response
| None ->
p.report (
{| message = Some "MSBuild failed with an unknown error"
increment = None |}
)

return response
}
|> Promise.toThenable)
)
|> Promise.ofThenable

let invokeMSBuild project target =
let autoshow =
let cfg = workspace.getConfiguration ()
Expand Down
Loading