test(defaults): add MSBuild evaluation test coverage for NetEvolve.Defaults - #477
#477test(defaults): add MSBuild evaluation test coverage for NetEvolve.Defaults#477samtrion merged 3 commits intomaindailydevops/defaults:mainfrom test/msbuild-defaults-propsdailydevops/defaults:test/msbuild-defaults-propsCopy head branch name to clipboard
Conversation
|
Important Review skippedAuto reviews are limited based on label configuration. 🏷️ Required labels (at least one) (1)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…faults Add a NetEvolve.Defaults.Tests.Unit TUnit project that evaluates the props/targets under src/NetEvolve.Defaults via the MSBuild API instead of running a full build. Covers project categorization (IsTestableProject, IsXampleProject), the CI-detection precedence chain across ~15 CI systems and branch/PR-ref resolution, NoWarn/severity matrices, and the remaining Support*.props/.targets files, including edge cases beyond the happy path. Add Microsoft.Build and Microsoft.Build.Locator package versions to Directory.Packages.props to support MSBuild-API-based evaluation tests. chore(tests): remove NetEvolve.Defaults.Tests.Integration Superseded by the new unit test coverage; it only contained a single placeholder "always true" test. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013cR8rWVwvVY2bfM4QyKvtw
…onfig SupportNuGetAudit.targets appended the audit warning codes with a missing '$' before "(WarningsAsErrors)", so the literal text replaced any pre-existing WarningsAsErrors value instead of preserving and appending to it. Also give IsCrossTargetingProject an explicit "false" default in SupportAdditionalFiles.targets, consistent with IsTestableProject/ IsXampleProject in SupportGeneral.props, instead of evaluating to an empty string when TargetFrameworks is unset. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013cR8rWVwvVY2bfM4QyKvtw
1bb0eab to
5b9852d
Compare
MSBuildProjectFixture only overrode the CI/branch-detection variables that a given test cared about, so any variable it didn't set fell back to the real process environment. On an actual GitHub Actions PR runner this leaked GITHUB_ACTIONS/GITHUB_REF/etc. into every evaluation, making several SupportDetectContinuousIntegration tests pass locally but fail in CI. Neutralize the full set of known CI-detection variables to empty by default, overridable per test via globalProperties. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013cR8rWVwvVY2bfM4QyKvtw
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #477 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 1 1
Lines 16 16
Branches 1 1
=========================================
Hits 16 16 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
NetEvolve.Defaults.Tests.Unit, a TUnit project that evaluates the props/targets undersrc/NetEvolve.Defaultsvia the MSBuild API (Microsoft.Build.Evaluation.Project) rather than running a full build. Covers project categorization (IsTestableProject,IsXampleProject), the CI-detection precedence chain across ~15 CI systems plus branch/PR-ref resolution,NoWarn/severity matrices, and the remainingSupport*.props/.targetsfiles — including edge cases beyond the happy path.Microsoft.BuildandMicrosoft.Build.Locatorpackage versions toDirectory.Packages.props(new entries only).NetEvolve.Defaults.Tests.Integration— superseded by the new coverage; it only contained a single placeholder "always true" test.Bugs found (flagged, not fixed here)
src/NetEvolve.Defaults/buildMultiTargeting/SupportNuGetAudit.targets:6—WarningsAsErrorsis appended as(WarningsAsErrors);NU1900;...missing the leading$, so the literal text"(WarningsAsErrors)"replaces any prior$(WarningsAsErrors)value instead of preserving it. Covered bySupportNuGetAuditTests.Release_WarningsAsErrors_ObservedBehaviorDiffersFromDocumentedIntent_LiteralParenthesesTokenInsteadOfPriorValue, which asserts the current (buggy) behavior.SupportAdditionalFiles.targets—IsCrossTargetingProjecthas no unconditioned default, so it evaluates to""rather than"false"whenTargetFrameworksis unset (minor, likely harmless). Covered bySupportAdditionalFilesTests.TargetFrameworksNotSet_IsCrossTargetingProject_ObservedBehaviorDiffersFromDocumentedIntent_StaysEmptyNotFalse.Test plan
dotnet build— cleandotnet testintests/NetEvolve.Defaults.Tests.Unit— 86/86 passedgit statusconfirms nothing undersrc/was modified🤖 Generated with Claude Code
https://claude.ai/code/session_013cR8rWVwvVY2bfM4QyKvtw