Repository navigation
test(unit): cover ProjectFactory default environment variables and directory fallback - #260
Merged
Merged
Conversation
…rectory fallback Stryker reports 12 surviving mutants on ProjectFactory.cs lines 83-94 (constructor fallbacks and the default environment variable dictionary). Existing tests only inspect variables they add themselves. Assert the five default entries (CI and GITHUB_ACTIONS as null, the three DOTNET_* values), the temporary directory fallback and that a provided directory is used as-is.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #260 +/- ##
=======================================
Coverage 89.69% 89.69%
=======================================
Files 31 31
Lines 728 728
Branches 85 85
=======================================
Hits 653 653
Misses 67 67
Partials 8 8 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Problem
Mutation report for
src/NetEvolve.ProjectBuilders/ProjectFactory.cs(latest successful mutation run): 12 mutants survive on lines 83-94 (83, 85, 88, 90, 91 x2, 92 x2, 93 x2, 94). File total: 56 survived, 35 killed, 9 NoCoverage, 7 compile errors, 24 ignored. Nothing asserts the default values.Root cause
ProjectFactoryTestsonly checks variables the test adds itself (MY_VAR,VAR_A,VAR_B). The default dictionary (CI/GITHUB_ACTIONS null, three DOTNET_* values) and thedirectory ??constructor fallback are never asserted.Change
Tests only, in
ProjectFactoryTests.cs:Create_Default_SetsDefaultEnvironmentVariables: exact 5 entries incl. null for CI and GITHUB_ACTIONS, plus a case-insensitive lookup.Create_WithoutDirectory_UsesTemporaryDirectoryBuilderandCreate_WithDirectory_UsesProvidedDirectory: cover the line 85 fallback.Before / After
After run: https://github.com/dailydevops/projectbuilders/actions/runs/40810176064 (success).
The remaining line 83 survivor (
logger ?? NullLogger) is not covered:_loggeris only used inBuildAsyncon SARIF output paths. The line 88 mutant replaces the initializer with{}(the comparer is kept), so thecilookup is a harmless extra.Risk / what this does not change
No production code changes;
AddEnvironmentVariablevalidation is untouched. Tests dispose the factory and temporary directory.