Skip to content

Commit 0ee93f6

Browse files
committed
feat: restore original framework selection behavor
1 parent 6b3f0bb commit 0ee93f6

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

src/Stryker.Core/Stryker.Core.UnitTest/Initialisation/InputFileResolverTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1143,10 +1143,10 @@ public void ShouldSelectFrameworkBasedOnTestProject(string testFrameworks
11431143
result.TestProjectsInfo.AnalyzerResults.First().TargetFramework.ShouldBe(expectedTestFramework);
11441144
}
11451145

1146-
// Stryker will ignore NetFramework target when runnning on non windows platforms
1146+
// Stryker accepts netframework targert when running on Windows
11471147
[TestMethodWithIgnoreIfSupport]
11481148
[IgnoreIf(nameof(Is.NotWindows))]
1149-
[DataRow("net462,netcoreapp3.0", "net461,netcoreapp2.0", null, "net462", "net461")]
1149+
[DataRow("net462", "net461", null, "net462", "net461")]
11501150
public void ShouldSelectFrameworkBasedOnTestProjectOnWindows(string testFrameworks
11511151
, string projectFrameworks
11521152
, string targetFramework

src/Stryker.Core/Stryker.Core/Initialisation/MutableProjectTree.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,9 @@ public void KeepOnlyOneTarget(string optionsTargetFramework)
5858
}
5959

6060
var mutableProjectTargets = Targets.Where(t => t.IsValidTarget);
61-
// on non windows platform, keep first non netframework target
62-
// on Windows, keep first netframework target if any, otherwise keep first valid target
63-
targetToKeep = mutableProjectTargets.FirstOrDefault( t => OperatingSystem.IsWindows() == t.ProjectTarget.TargetsFullFramework()) ??
64-
mutableProjectTargets.FirstOrDefault();
61+
// keep the first non netframework target otherwise pick the first one when running on Windows OS
62+
targetToKeep = mutableProjectTargets.FirstOrDefault( t => !t.ProjectTarget.TargetsFullFramework()) ??
63+
mutableProjectTargets.FirstOrDefault(_ => OperatingSystem.IsWindows());
6564
Targets.Clear();
6665
if (targetToKeep == null)
6766
{

0 commit comments

Comments
 (0)