Fail F# tests whose return value xUnit never executes - #20339
Merged
Conversation
An F# [<Fact>]/[<Theory>] that is accidentally a partial application (or otherwise returns a value xUnit never runs -- an FSharpFunc, a delegate, or a Lazy<_>) executes none of its assertions yet still reports success. A custom test framework fails such a method at discovery time by swapping it for xUnit's own ExecutionErrorTestCase; only discovery is customized, so the stock execution/runner chain (parallelism, console capture) is untouched. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 77be7136-44a4-468f-b8ec-2e5edeb2a76a
Contributor
✅ No release notes required |
…d-test-methods # Conflicts: # tests/FSharp.Test.Utilities/XunitSetup.fs
Member
Author
|
Guard fired on CI (build 1565003): 8 test legs red, 19 Root cause — two curried helpers drop the trailing let singleTestBuildAndRunVersion folder mode version = singleTestBuildAndRunAuxVersion folder [] mode version // missing sessionIsolation
let singleTestBuildAndRunAux folder bonusArgs mode = singleTestBuildAndRunAuxVersion folder bonusArgs mode LangVersion.Latest // missing sessionIsolationDead tests exposed:
|
Member
Author
|
@jwosty : |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 77be7136-44a4-468f-b8ec-2e5edeb2a76a
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 77be7136-44a4-468f-b8ec-2e5edeb2a76a
abonie
reviewed
Aug 26, 2026
jwosty
reviewed
Aug 26, 2026
T-Gro
enabled auto-merge (squash)
August 27, 2026 11:32
abonie
approved these changes
Sep 9, 2026
This was referenced Sep 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An F#
[<Fact>]/[<Theory>]that is accidentally a partial application — or otherwise returns a value xUnit never runs, anFSharpFunc, a delegate, or aLazy<_>— executes none of its assertions yet still reports success. A custom test framework now fails such a method at discovery time by swapping it for xUnit's ownExecutionErrorTestCase; only discovery is customized, so parallelism, console capture, and the rest of the runner chain stay stock.This is expected to turn currently-green tests red where a body silently never ran.