Retarget the test project to net8.0 so the test suite runs on current SDKs - #953
Open
ntdatt812 wants to merge 1 commit into
Open
Retarget the test project to net8.0 so the test suite runs on current SDKs#953ntdatt812 wants to merge 1 commit into
ntdatt812 wants to merge 1 commit into
Conversation
netcoreapp3.1 went out of support in December 2022 and no shipping SDK can run it, so that leg of the test matrix aborted before executing anything. On non-Windows machines that left no runnable tests at all. Moves the framework leg to net462, the lowest supported .NET Framework and the floor required by xunit.runner.visualstudio 2.8.2. The library still targets net461 and the net462 test assembly binds that same output, so coverage is unchanged. Also keys PLATFORM_DOTNET off "not .NET Framework" rather than the netcoreapp prefix, which would otherwise stop being defined. 684 tests pass on both net462 and net8.0. No test code or library targets were changed.
Author
|
Correcting my own note at the bottom of the description: AppVeyor did pick this up and the build passed, so disregard that remark about the project having no builds recorded — I had been looking at branch builds rather than PR builds. That also answers the question I could not check locally: the VS2019 image ships an SDK new enough for the https://ci.appveyor.com/project/commandlineparser/commandline/builds/54531788 |
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.
Summary
The test project targets
netcoreapp3.1, which went out of support in December 2022. No currently shipping .NET SDK can run it, so half the test matrix aborts before a single test executes:On Windows the
net461leg still runs, so you get 684 passing tests and an aborted run. On Linux or macOS neither leg runs, which meansdotnet testgives a contributor nothing at all.After this change both legs run:
Same 684 tests, no test code touched.
What changed
One file,
tests/CommandLine.Tests/CommandLine.Tests.csproj:netcoreapp3.1→net8.0net461→net462Microsoft.NET.Test.Sdk16.0.1 → 17.11.1,xunit2.4.1 → 2.9.2,xunit.runner.visualstudio2.4.1 → 2.8.2PLATFORM_DOTNETcondition now keys off "not .NET Framework" instead of "starts with netcoreapp"Notes on the two less obvious bits
Why
net462.xunit.runner.visualstudio2.8.2 has a floor of net462, so the old runner has to stay or the framework leg has to move up. net461 has been out of support since April 2022 and net462 is the lowest supported .NET Framework, so moving up seemed better than pinning the runner.This does not reduce what gets covered. The library still targets
net461and the net462 test assembly resolves that exact output — I compared the hashes to be sure:The
net8.0leg picks upnetstandard2.0, which is what everyone on modern .NET actually consumes and what previously had no runnable coverage at all.The
PLATFORM_DOTNETcondition. It wasTargetFramework.StartsWith('netcoreapp'), so renaming the TFM tonet8.0would have silently stopped defining it and dropped ausinginOptionMapperTests.cs. Keying off!StartsWith('net4')keeps it defined for every non-Framework target.Scope
I deliberately left
src/CommandLine/CommandLine.csprojalone — it still targetsnetstandard2.0;net40;net45;net461, so this changes nothing for consumers. #786 asks for the library itself to move, which is a separate conversation with real compatibility implications; this is just the part that stops contributors from running the tests.One thing I noticed while looking around: the AppVeyor project has no builds recorded, so the badge in the README may not reflect anything current. If it would help, I'm happy to follow up with a small GitHub Actions workflow that builds and runs both legs on pull requests.