From 853cbd9277842c79ff3253692314c2cf36dd3065 Mon Sep 17 00:00:00 2001 From: Richard Werkman Date: Fri, 5 Aug 2022 17:07:43 +0200 Subject: [PATCH 01/27] init --- src/Stryker.CLI/Stryker.CLI/StrykerCLI.cs | 41 +++++++-- .../Inputs/BaselineCreateInputTests.cs | 86 +++++++++++++++++++ .../Inputs/BaselineCreateEnabledInput.cs | 11 +++ .../Options/Inputs/OpenReportEnabledInput.cs | 2 +- .../Stryker.Core/Options/StrykerInputs.cs | 6 +- .../Stryker.Core/Options/StrykerOptions.cs | 5 ++ 6 files changed, 141 insertions(+), 10 deletions(-) create mode 100644 src/Stryker.Core/Stryker.Core.UnitTest/Options/Inputs/BaselineCreateInputTests.cs create mode 100644 src/Stryker.Core/Stryker.Core/Options/Inputs/BaselineCreateEnabledInput.cs diff --git a/src/Stryker.CLI/Stryker.CLI/StrykerCLI.cs b/src/Stryker.CLI/Stryker.CLI/StrykerCLI.cs index ebe3b6fda2..d80e71b3a1 100644 --- a/src/Stryker.CLI/Stryker.CLI/StrykerCLI.cs +++ b/src/Stryker.CLI/Stryker.CLI/StrykerCLI.cs @@ -56,17 +56,29 @@ public int Run(string[] args) cmdConfigReader.RegisterCommandLineOptions(app, inputs); - app.OnExecute(() => + app.Command("baseline", baselineCmd => { - // app started - PrintStrykerASCIIName(); + baselineCmd.Description = "Enables the baseline feature"; + inputs.WithBaselineInput.SuppliedInput = true; - _configReader.Build(inputs, args, app, cmdConfigReader); - _loggingInitializer.SetupLogOptions(inputs); + baselineCmd.Command("create", createCmd => + { + createCmd.OnExecute(() => + { + createCmd.Description = "Creates a new baseline by doing a full stryker run"; + inputs.BaselineCreateEnabledInput.SuppliedInput = true; + return StartApp(inputs, args, app, cmdConfigReader); + }); + }); + baselineCmd.OnExecute(() => + { + return StartApp(inputs, args, app, cmdConfigReader); + }); + }); - PrintStrykerVersionInformationAsync(); - RunStryker(inputs); - return ExitCode; + app.OnExecute(() => + { + return StartApp(inputs, args, app, cmdConfigReader); }); try @@ -88,6 +100,19 @@ public int Run(string[] args) } } + private int StartApp(StrykerInputs inputs, string[] args, CommandLineApplication app, CommandLineConfigReader cmdConfigReader) + { + // app started + PrintStrykerASCIIName(); + + _configReader.Build(inputs, args, app, cmdConfigReader); + _loggingInitializer.SetupLogOptions(inputs); + + PrintStrykerVersionInformationAsync(); + RunStryker(inputs); + return ExitCode; + } + private void RunStryker(IStrykerInputs inputs) { var result = _stryker.RunMutationTest(inputs, ApplicationLogging.LoggerFactory); diff --git a/src/Stryker.Core/Stryker.Core.UnitTest/Options/Inputs/BaselineCreateInputTests.cs b/src/Stryker.Core/Stryker.Core.UnitTest/Options/Inputs/BaselineCreateInputTests.cs new file mode 100644 index 0000000000..a3ec55ead6 --- /dev/null +++ b/src/Stryker.Core/Stryker.Core.UnitTest/Options/Inputs/BaselineCreateInputTests.cs @@ -0,0 +1,86 @@ +using Shouldly; +using Stryker.Core.Baseline.Providers; +using Stryker.Core.Exceptions; +using Stryker.Core.Options.Inputs; +using Stryker.Core.Reporters; +using Xunit; + +namespace Stryker.Core.UnitTest.Options.Inputs +{ + public class BaselineProviderInputTests : TestBase + { + [Fact] + public void ShouldHaveHelpText() + { + var target = new BaselineProviderInput(); + target.HelpText.ShouldBe("Choose a storage location for dashboard compare. Set to Dashboard provider when the dashboard reporter is turned on. | default: 'disk' | allowed: Dashboard, Disk, AzureFileStorage"); + } + + [Fact] + public void ShouldHaveDefault() + { + var target = new BaselineProviderInput { SuppliedInput = null }; + + var result = target.Validate(new Reporter[] { }); + + target.Default.ShouldBe("disk"); + result.ShouldBe(BaselineProvider.Disk); + } + + [Fact] + public void ShouldHaveDefaultForDashboard() + { + var target = new BaselineProviderInput { SuppliedInput = null }; + + var result = target.Validate(new[] { Reporter.Dashboard }); + + result.ShouldBe(BaselineProvider.Dashboard); + } + + [Theory] + [InlineData("disk")] + [InlineData("Disk")] + public void ShouldSetDisk(string value) + { + var target = new BaselineProviderInput { SuppliedInput = value }; + + var result = target.Validate(new[] { Reporter.Dashboard }); + + result.ShouldBe(BaselineProvider.Disk); + } + + [Theory] + [InlineData("dashboard")] + [InlineData("Dashboard")] + public void ShouldSetDashboard(string value) + { + var target = new BaselineProviderInput { SuppliedInput = value }; + + var result = target.Validate(new[] { Reporter.Dashboard }); + + result.ShouldBe(BaselineProvider.Dashboard); + } + + [Theory] + [InlineData("azurefilestorage")] + [InlineData("AzureFileStorage")] + public void ShouldSetAzureFileStorage(string value) + { + var target = new BaselineProviderInput { SuppliedInput = value }; + + var result = target.Validate(new[] { Reporter.Dashboard }); + + result.ShouldBe(BaselineProvider.AzureFileStorage); + } + + [Fact] + public void ShouldThrowException_OnInvalidInput() + { + var target = new BaselineProviderInput { SuppliedInput = "invalid" }; + + var exception = Should.Throw(() => target.Validate(new[] { Reporter.Dashboard })); + + exception.Message.ShouldBe("Baseline storage provider 'invalid' does not exist"); + } + } +} diff --git a/src/Stryker.Core/Stryker.Core/Options/Inputs/BaselineCreateEnabledInput.cs b/src/Stryker.Core/Stryker.Core/Options/Inputs/BaselineCreateEnabledInput.cs new file mode 100644 index 0000000000..23021fa75f --- /dev/null +++ b/src/Stryker.Core/Stryker.Core/Options/Inputs/BaselineCreateEnabledInput.cs @@ -0,0 +1,11 @@ +namespace Stryker.Core.Options.Inputs +{ + public class BaselineCreateEnabledInput : Input + { + public override bool Default => false; + + protected override string Description => "When enabled a new baseline will be created by doing a full run and storing the mutation results."; + + public bool Validate() => SuppliedInput; + } +} diff --git a/src/Stryker.Core/Stryker.Core/Options/Inputs/OpenReportEnabledInput.cs b/src/Stryker.Core/Stryker.Core/Options/Inputs/OpenReportEnabledInput.cs index 504ae30baa..ee1a1fe008 100644 --- a/src/Stryker.Core/Stryker.Core/Options/Inputs/OpenReportEnabledInput.cs +++ b/src/Stryker.Core/Stryker.Core/Options/Inputs/OpenReportEnabledInput.cs @@ -4,7 +4,7 @@ public class OpenReportEnabledInput : Input { public override bool Default => false; - protected override string Description => ""; + protected override string Description => "When enabled the report will open automatically after stryker has generated the report."; public bool Validate() => SuppliedInput; } diff --git a/src/Stryker.Core/Stryker.Core/Options/StrykerInputs.cs b/src/Stryker.Core/Stryker.Core/Options/StrykerInputs.cs index 6fbb69c3a3..f3f84b55a9 100644 --- a/src/Stryker.Core/Stryker.Core/Options/StrykerInputs.cs +++ b/src/Stryker.Core/Stryker.Core/Options/StrykerInputs.cs @@ -8,6 +8,7 @@ public interface IStrykerInputs AdditionalTimeoutInput AdditionalTimeoutInput { get; init; } AzureFileStorageSasInput AzureFileStorageSasInput { get; init; } AzureFileStorageUrlInput AzureFileStorageUrlInput { get; init; } + BaselineCreateEnabledInput BaselineCreateEnabledInput { get; init; } BaselineProviderInput BaselineProviderInput { get; init; } BasePathInput BasePathInput { get; init; } ConcurrencyInput ConcurrencyInput { get; init; } @@ -78,8 +79,9 @@ public StrykerInputs(IFileSystem fileSystem = null) public ProjectUnderTestNameInput ProjectUnderTestNameInput { get; init; } = new(); public TestProjectsInput TestProjectsInput { get; init; } = new(); public TestCaseFilterInput TestCaseFilterInput { get; init; } = new(); - public WithBaselineInput WithBaselineInput { get; init; } = new(); public ReportersInput ReportersInput { get; init; } = new(); + public BaselineCreateEnabledInput BaselineCreateEnabledInput { get; init; } = new(); + public WithBaselineInput WithBaselineInput { get; init; } = new(); public BaselineProviderInput BaselineProviderInput { get; init; } = new(); public AzureFileStorageUrlInput AzureFileStorageUrlInput { get; init; } = new(); public AzureFileStorageSasInput AzureFileStorageSasInput { get; init; } = new(); @@ -107,6 +109,7 @@ public StrykerOptions ValidateAll() var basePath = BasePathInput.Validate(_fileSystem); var outputPath = OutputPathInput.Validate(_fileSystem); var reportFileNameInput = ReportFileNameInput.Validate(); + var baselineCreateEnabled = BaselineCreateEnabledInput.Validate(); var withBaseline = WithBaselineInput.Validate(); var reporters = ReportersInput.Validate(withBaseline); var baselineProvider = BaselineProviderInput.Validate(reporters); @@ -155,6 +158,7 @@ public StrykerOptions ValidateAll() DiffIgnoreChanges = DiffIgnoreChangesInput.Validate(), AzureFileStorageSas = AzureFileStorageSasInput.Validate(baselineProvider), AzureFileStorageUrl = AzureFileStorageUrlInput.Validate(baselineProvider), + BaselineCreateEnabled = baselineCreateEnabled, WithBaseline = withBaseline, BaselineProvider = baselineProvider, FallbackVersion = FallbackVersionInput.Validate(withBaseline, projectVersion, sinceTarget), diff --git a/src/Stryker.Core/Stryker.Core/Options/StrykerOptions.cs b/src/Stryker.Core/Stryker.Core/Options/StrykerOptions.cs index 796b3ebeab..1f704772a7 100644 --- a/src/Stryker.Core/Stryker.Core/Options/StrykerOptions.cs +++ b/src/Stryker.Core/Stryker.Core/Options/StrykerOptions.cs @@ -102,6 +102,11 @@ public class StrykerOptions /// public IEnumerable Reporters { get; init; } = Enumerable.Empty(); + /// + /// When true, a new baseline should be created. + /// + public bool BaselineCreateEnabled { get; init; } + /// /// When true, the baseline feature should be enabled. /// From e986e6829c5c2c50295911e49540284540598d68 Mon Sep 17 00:00:00 2001 From: Richard Werkman Date: Fri, 5 Aug 2022 18:11:47 +0200 Subject: [PATCH 02/27] Fix unit tests --- .../Inputs/BaselineCreateEnabledInputTests.cs | 41 +++++++++ .../Inputs/BaselineCreateInputTests.cs | 86 ------------------- 2 files changed, 41 insertions(+), 86 deletions(-) create mode 100644 src/Stryker.Core/Stryker.Core.UnitTest/Options/Inputs/BaselineCreateEnabledInputTests.cs delete mode 100644 src/Stryker.Core/Stryker.Core.UnitTest/Options/Inputs/BaselineCreateInputTests.cs diff --git a/src/Stryker.Core/Stryker.Core.UnitTest/Options/Inputs/BaselineCreateEnabledInputTests.cs b/src/Stryker.Core/Stryker.Core.UnitTest/Options/Inputs/BaselineCreateEnabledInputTests.cs new file mode 100644 index 0000000000..aebe18d859 --- /dev/null +++ b/src/Stryker.Core/Stryker.Core.UnitTest/Options/Inputs/BaselineCreateEnabledInputTests.cs @@ -0,0 +1,41 @@ +using Shouldly; +using Stryker.Core.Baseline.Providers; +using Stryker.Core.Exceptions; +using Stryker.Core.Options.Inputs; +using Stryker.Core.Reporters; +using Xunit; + +namespace Stryker.Core.UnitTest.Options.Inputs +{ + public class BaselineCreateEnabledInputTests : TestBase + { + [Fact] + public void ShouldHaveHelpText() + { + var target = new BaselineCreateEnabledInput(); + target.HelpText.ShouldBe("When enabled a new baseline will be created by doing a full run and storing the mutation results. | default: 'False'"); + } + + [Fact] + public void ShouldHaveDefault() + { + var target = new BaselineCreateEnabledInput { SuppliedInput = true }; + + var result = target.Validate(); + + target.Default.ShouldBeFalse(); + result.ShouldBeTrue(); + } + + [Fact] + public void ShouldHaveDefaultForDashboard() + { + var target = new BaselineCreateEnabledInput { SuppliedInput = false }; + + var result = target.Validate(); + + target.Default.ShouldBeFalse(); + result.ShouldBeFalse(); + } + } +} diff --git a/src/Stryker.Core/Stryker.Core.UnitTest/Options/Inputs/BaselineCreateInputTests.cs b/src/Stryker.Core/Stryker.Core.UnitTest/Options/Inputs/BaselineCreateInputTests.cs deleted file mode 100644 index a3ec55ead6..0000000000 --- a/src/Stryker.Core/Stryker.Core.UnitTest/Options/Inputs/BaselineCreateInputTests.cs +++ /dev/null @@ -1,86 +0,0 @@ -using Shouldly; -using Stryker.Core.Baseline.Providers; -using Stryker.Core.Exceptions; -using Stryker.Core.Options.Inputs; -using Stryker.Core.Reporters; -using Xunit; - -namespace Stryker.Core.UnitTest.Options.Inputs -{ - public class BaselineProviderInputTests : TestBase - { - [Fact] - public void ShouldHaveHelpText() - { - var target = new BaselineProviderInput(); - target.HelpText.ShouldBe("Choose a storage location for dashboard compare. Set to Dashboard provider when the dashboard reporter is turned on. | default: 'disk' | allowed: Dashboard, Disk, AzureFileStorage"); - } - - [Fact] - public void ShouldHaveDefault() - { - var target = new BaselineProviderInput { SuppliedInput = null }; - - var result = target.Validate(new Reporter[] { }); - - target.Default.ShouldBe("disk"); - result.ShouldBe(BaselineProvider.Disk); - } - - [Fact] - public void ShouldHaveDefaultForDashboard() - { - var target = new BaselineProviderInput { SuppliedInput = null }; - - var result = target.Validate(new[] { Reporter.Dashboard }); - - result.ShouldBe(BaselineProvider.Dashboard); - } - - [Theory] - [InlineData("disk")] - [InlineData("Disk")] - public void ShouldSetDisk(string value) - { - var target = new BaselineProviderInput { SuppliedInput = value }; - - var result = target.Validate(new[] { Reporter.Dashboard }); - - result.ShouldBe(BaselineProvider.Disk); - } - - [Theory] - [InlineData("dashboard")] - [InlineData("Dashboard")] - public void ShouldSetDashboard(string value) - { - var target = new BaselineProviderInput { SuppliedInput = value }; - - var result = target.Validate(new[] { Reporter.Dashboard }); - - result.ShouldBe(BaselineProvider.Dashboard); - } - - [Theory] - [InlineData("azurefilestorage")] - [InlineData("AzureFileStorage")] - public void ShouldSetAzureFileStorage(string value) - { - var target = new BaselineProviderInput { SuppliedInput = value }; - - var result = target.Validate(new[] { Reporter.Dashboard }); - - result.ShouldBe(BaselineProvider.AzureFileStorage); - } - - [Fact] - public void ShouldThrowException_OnInvalidInput() - { - var target = new BaselineProviderInput { SuppliedInput = "invalid" }; - - var exception = Should.Throw(() => target.Validate(new[] { Reporter.Dashboard })); - - exception.Message.ShouldBe("Baseline storage provider 'invalid' does not exist"); - } - } -} From 68d4e39dd3c9b38b3e0b14578c66aa9292dfd02c Mon Sep 17 00:00:00 2001 From: Richard Werkman Date: Fri, 9 Jun 2023 09:57:49 +0200 Subject: [PATCH 03/27] Baseline recreate added --- .../Stryker.CLI.UnitTest/packages.lock.json | 64 +++++++++---------- src/Stryker.CLI/Stryker.CLI/StrykerCLI.cs | 4 +- .../Stryker.CLI/packages.lock.json | 56 ++++++++-------- .../Inputs/BaselineCreateEnabledInputTests.cs | 6 +- .../Stryker.Core.UnitTest/packages.lock.json | 56 ++++++++-------- .../MutantFilters/BaselineMutantFilter.cs | 6 ++ .../Inputs/BaselineCreateEnabledInput.cs | 2 +- .../Stryker.Core/Options/StrykerInputs.cs | 8 +-- .../Stryker.Core/Options/StrykerOptions.cs | 2 +- .../Stryker.Core/packages.lock.json | 6 +- .../packages.lock.json | 2 +- 11 files changed, 109 insertions(+), 103 deletions(-) diff --git a/src/Stryker.CLI/Stryker.CLI.UnitTest/packages.lock.json b/src/Stryker.CLI/Stryker.CLI.UnitTest/packages.lock.json index ba890f157e..79115088d6 100644 --- a/src/Stryker.CLI/Stryker.CLI.UnitTest/packages.lock.json +++ b/src/Stryker.CLI/Stryker.CLI.UnitTest/packages.lock.json @@ -1596,53 +1596,53 @@ "dotnet-stryker": { "type": "Project", "dependencies": { - "McMaster.Extensions.CommandLineUtils": "[4.0.2, )", - "NuGet.Protocol": "[6.6.0, )", - "YamlDotNet": "[13.1.0, )", - "stryker": "[3.9.0, )" + "McMaster.Extensions.CommandLineUtils": "4.0.2", + "NuGet.Protocol": "6.6.0", + "YamlDotNet": "13.1.0", + "stryker": "3.9.0" } }, "stryker": { "type": "Project", "dependencies": { - "Buildalyzer": "[5.0.0, )", - "DotNet.Glob": "[3.1.3, )", - "FSharp.Compiler.Service": "[41.0.7, )", - "Grynwald.MarkdownGenerator": "[3.0.106, )", - "LibGit2Sharp": "[0.27.2, )", - "Microsoft.CodeAnalysis.CSharp": "[4.6.0, )", - "Microsoft.Extensions.Logging": "[7.0.0, )", - "Microsoft.TestPlatform": "[17.6.0, )", - "Microsoft.TestPlatform.ObjectModel": "[17.6.0, )", - "Microsoft.TestPlatform.Portable": "[17.6.0, )", - "Microsoft.TestPlatform.TranslationLayer": "[17.6.0, )", - "Microsoft.Web.LibraryManager.Build": "[2.1.175, )", - "Mono.Cecil": "[0.11.5, )", - "NuGet.Frameworks": "[6.6.0, )", - "ResXResourceReader.NetStandard": "[1.1.0, )", - "Serilog": "[2.12.0, )", - "Serilog.Extensions.Logging": "[7.0.0, )", - "Serilog.Extensions.Logging.File": "[3.0.0, )", - "Serilog.Sinks.Console": "[4.1.0, )", - "ShellProgressBar": "[5.2.0, )", - "Spectre.Console": "[0.47.0, )", - "Spectre.Console.Analyzer": "[0.47.0, )", - "Stryker.DataCollector": "[3.9.0, )", - "Stryker.RegexMutators": "[3.9.0, )", - "TestableIO.System.IO.Abstractions.Wrappers": "[19.2.29, )" + "Buildalyzer": "5.0.0", + "DotNet.Glob": "3.1.3", + "FSharp.Compiler.Service": "41.0.7", + "Grynwald.MarkdownGenerator": "3.0.106", + "LibGit2Sharp": "0.27.2", + "Microsoft.CodeAnalysis.CSharp": "4.6.0", + "Microsoft.Extensions.Logging": "7.0.0", + "Microsoft.TestPlatform": "17.6.0", + "Microsoft.TestPlatform.ObjectModel": "17.6.0", + "Microsoft.TestPlatform.Portable": "17.6.0", + "Microsoft.TestPlatform.TranslationLayer": "17.6.0", + "Microsoft.Web.LibraryManager.Build": "2.1.175", + "Mono.Cecil": "0.11.5", + "NuGet.Frameworks": "6.6.0", + "ResXResourceReader.NetStandard": "1.1.0", + "Serilog": "2.12.0", + "Serilog.Extensions.Logging": "7.0.0", + "Serilog.Extensions.Logging.File": "3.0.0", + "Serilog.Sinks.Console": "4.1.0", + "ShellProgressBar": "5.2.0", + "Spectre.Console": "0.47.0", + "Spectre.Console.Analyzer": "0.47.0", + "Stryker.DataCollector": "1.0.0", + "Stryker.RegexMutators": "1.0.0", + "TestableIO.System.IO.Abstractions.Wrappers": "19.2.29" } }, "stryker.datacollector": { "type": "Project", "dependencies": { - "Microsoft.TestPlatform.ObjectModel": "[17.6.0, )", - "Microsoft.TestPlatform.Portable": "[17.6.0, )" + "Microsoft.TestPlatform.ObjectModel": "17.6.0", + "Microsoft.TestPlatform.Portable": "17.6.0" } }, "stryker.regexmutators": { "type": "Project", "dependencies": { - "RegexParser": "[0.5.1, )" + "RegexParser": "0.5.1" } }, "Buildalyzer": { diff --git a/src/Stryker.CLI/Stryker.CLI/StrykerCLI.cs b/src/Stryker.CLI/Stryker.CLI/StrykerCLI.cs index d80e71b3a1..77163863da 100644 --- a/src/Stryker.CLI/Stryker.CLI/StrykerCLI.cs +++ b/src/Stryker.CLI/Stryker.CLI/StrykerCLI.cs @@ -61,12 +61,12 @@ public int Run(string[] args) baselineCmd.Description = "Enables the baseline feature"; inputs.WithBaselineInput.SuppliedInput = true; - baselineCmd.Command("create", createCmd => + baselineCmd.Command("recreate", createCmd => { createCmd.OnExecute(() => { createCmd.Description = "Creates a new baseline by doing a full stryker run"; - inputs.BaselineCreateEnabledInput.SuppliedInput = true; + inputs.BaselineRecreateEnabledInput.SuppliedInput = true; return StartApp(inputs, args, app, cmdConfigReader); }); }); diff --git a/src/Stryker.CLI/Stryker.CLI/packages.lock.json b/src/Stryker.CLI/Stryker.CLI/packages.lock.json index ebc8bcf3de..a06fbf12a8 100644 --- a/src/Stryker.CLI/Stryker.CLI/packages.lock.json +++ b/src/Stryker.CLI/Stryker.CLI/packages.lock.json @@ -1440,44 +1440,44 @@ "stryker": { "type": "Project", "dependencies": { - "Buildalyzer": "[5.0.0, )", - "DotNet.Glob": "[3.1.3, )", - "FSharp.Compiler.Service": "[41.0.7, )", - "Grynwald.MarkdownGenerator": "[3.0.106, )", - "LibGit2Sharp": "[0.27.2, )", - "Microsoft.CodeAnalysis.CSharp": "[4.6.0, )", - "Microsoft.Extensions.Logging": "[7.0.0, )", - "Microsoft.TestPlatform": "[17.6.0, )", - "Microsoft.TestPlatform.ObjectModel": "[17.6.0, )", - "Microsoft.TestPlatform.Portable": "[17.6.0, )", - "Microsoft.TestPlatform.TranslationLayer": "[17.6.0, )", - "Microsoft.Web.LibraryManager.Build": "[2.1.175, )", - "Mono.Cecil": "[0.11.5, )", - "NuGet.Frameworks": "[6.6.0, )", - "ResXResourceReader.NetStandard": "[1.1.0, )", - "Serilog": "[2.12.0, )", - "Serilog.Extensions.Logging": "[7.0.0, )", - "Serilog.Extensions.Logging.File": "[3.0.0, )", - "Serilog.Sinks.Console": "[4.1.0, )", - "ShellProgressBar": "[5.2.0, )", - "Spectre.Console": "[0.47.0, )", - "Spectre.Console.Analyzer": "[0.47.0, )", - "Stryker.DataCollector": "[3.9.0, )", - "Stryker.RegexMutators": "[3.9.0, )", - "TestableIO.System.IO.Abstractions.Wrappers": "[19.2.29, )" + "Buildalyzer": "5.0.0", + "DotNet.Glob": "3.1.3", + "FSharp.Compiler.Service": "41.0.7", + "Grynwald.MarkdownGenerator": "3.0.106", + "LibGit2Sharp": "0.27.2", + "Microsoft.CodeAnalysis.CSharp": "4.6.0", + "Microsoft.Extensions.Logging": "7.0.0", + "Microsoft.TestPlatform": "17.6.0", + "Microsoft.TestPlatform.ObjectModel": "17.6.0", + "Microsoft.TestPlatform.Portable": "17.6.0", + "Microsoft.TestPlatform.TranslationLayer": "17.6.0", + "Microsoft.Web.LibraryManager.Build": "2.1.175", + "Mono.Cecil": "0.11.5", + "NuGet.Frameworks": "6.6.0", + "ResXResourceReader.NetStandard": "1.1.0", + "Serilog": "2.12.0", + "Serilog.Extensions.Logging": "7.0.0", + "Serilog.Extensions.Logging.File": "3.0.0", + "Serilog.Sinks.Console": "4.1.0", + "ShellProgressBar": "5.2.0", + "Spectre.Console": "0.47.0", + "Spectre.Console.Analyzer": "0.47.0", + "Stryker.DataCollector": "1.0.0", + "Stryker.RegexMutators": "1.0.0", + "TestableIO.System.IO.Abstractions.Wrappers": "19.2.29" } }, "stryker.datacollector": { "type": "Project", "dependencies": { - "Microsoft.TestPlatform.ObjectModel": "[17.6.0, )", - "Microsoft.TestPlatform.Portable": "[17.6.0, )" + "Microsoft.TestPlatform.ObjectModel": "17.6.0", + "Microsoft.TestPlatform.Portable": "17.6.0" } }, "stryker.regexmutators": { "type": "Project", "dependencies": { - "RegexParser": "[0.5.1, )" + "RegexParser": "0.5.1" } }, "Buildalyzer": { diff --git a/src/Stryker.Core/Stryker.Core.UnitTest/Options/Inputs/BaselineCreateEnabledInputTests.cs b/src/Stryker.Core/Stryker.Core.UnitTest/Options/Inputs/BaselineCreateEnabledInputTests.cs index aebe18d859..99bfff5313 100644 --- a/src/Stryker.Core/Stryker.Core.UnitTest/Options/Inputs/BaselineCreateEnabledInputTests.cs +++ b/src/Stryker.Core/Stryker.Core.UnitTest/Options/Inputs/BaselineCreateEnabledInputTests.cs @@ -12,14 +12,14 @@ public class BaselineCreateEnabledInputTests : TestBase [Fact] public void ShouldHaveHelpText() { - var target = new BaselineCreateEnabledInput(); + var target = new BaselineRereateEnabledInput(); target.HelpText.ShouldBe("When enabled a new baseline will be created by doing a full run and storing the mutation results. | default: 'False'"); } [Fact] public void ShouldHaveDefault() { - var target = new BaselineCreateEnabledInput { SuppliedInput = true }; + var target = new BaselineRereateEnabledInput { SuppliedInput = true }; var result = target.Validate(); @@ -30,7 +30,7 @@ public void ShouldHaveDefault() [Fact] public void ShouldHaveDefaultForDashboard() { - var target = new BaselineCreateEnabledInput { SuppliedInput = false }; + var target = new BaselineRereateEnabledInput { SuppliedInput = false }; var result = target.Validate(); diff --git a/src/Stryker.Core/Stryker.Core.UnitTest/packages.lock.json b/src/Stryker.Core/Stryker.Core.UnitTest/packages.lock.json index 2d3203b140..684752024f 100644 --- a/src/Stryker.Core/Stryker.Core.UnitTest/packages.lock.json +++ b/src/Stryker.Core/Stryker.Core.UnitTest/packages.lock.json @@ -1580,44 +1580,44 @@ "stryker": { "type": "Project", "dependencies": { - "Buildalyzer": "[5.0.0, )", - "DotNet.Glob": "[3.1.3, )", - "FSharp.Compiler.Service": "[41.0.7, )", - "Grynwald.MarkdownGenerator": "[3.0.106, )", - "LibGit2Sharp": "[0.27.2, )", - "Microsoft.CodeAnalysis.CSharp": "[4.6.0, )", - "Microsoft.Extensions.Logging": "[7.0.0, )", - "Microsoft.TestPlatform": "[17.6.0, )", - "Microsoft.TestPlatform.ObjectModel": "[17.6.0, )", - "Microsoft.TestPlatform.Portable": "[17.6.0, )", - "Microsoft.TestPlatform.TranslationLayer": "[17.6.0, )", - "Microsoft.Web.LibraryManager.Build": "[2.1.175, )", - "Mono.Cecil": "[0.11.5, )", - "NuGet.Frameworks": "[6.6.0, )", - "ResXResourceReader.NetStandard": "[1.1.0, )", - "Serilog": "[2.12.0, )", - "Serilog.Extensions.Logging": "[7.0.0, )", - "Serilog.Extensions.Logging.File": "[3.0.0, )", - "Serilog.Sinks.Console": "[4.1.0, )", - "ShellProgressBar": "[5.2.0, )", - "Spectre.Console": "[0.47.0, )", - "Spectre.Console.Analyzer": "[0.47.0, )", - "Stryker.DataCollector": "[3.9.0, )", - "Stryker.RegexMutators": "[3.9.0, )", - "TestableIO.System.IO.Abstractions.Wrappers": "[19.2.29, )" + "Buildalyzer": "5.0.0", + "DotNet.Glob": "3.1.3", + "FSharp.Compiler.Service": "41.0.7", + "Grynwald.MarkdownGenerator": "3.0.106", + "LibGit2Sharp": "0.27.2", + "Microsoft.CodeAnalysis.CSharp": "4.6.0", + "Microsoft.Extensions.Logging": "7.0.0", + "Microsoft.TestPlatform": "17.6.0", + "Microsoft.TestPlatform.ObjectModel": "17.6.0", + "Microsoft.TestPlatform.Portable": "17.6.0", + "Microsoft.TestPlatform.TranslationLayer": "17.6.0", + "Microsoft.Web.LibraryManager.Build": "2.1.175", + "Mono.Cecil": "0.11.5", + "NuGet.Frameworks": "6.6.0", + "ResXResourceReader.NetStandard": "1.1.0", + "Serilog": "2.12.0", + "Serilog.Extensions.Logging": "7.0.0", + "Serilog.Extensions.Logging.File": "3.0.0", + "Serilog.Sinks.Console": "4.1.0", + "ShellProgressBar": "5.2.0", + "Spectre.Console": "0.47.0", + "Spectre.Console.Analyzer": "0.47.0", + "Stryker.DataCollector": "1.0.0", + "Stryker.RegexMutators": "1.0.0", + "TestableIO.System.IO.Abstractions.Wrappers": "19.2.29" } }, "stryker.datacollector": { "type": "Project", "dependencies": { - "Microsoft.TestPlatform.ObjectModel": "[17.6.0, )", - "Microsoft.TestPlatform.Portable": "[17.6.0, )" + "Microsoft.TestPlatform.ObjectModel": "17.6.0", + "Microsoft.TestPlatform.Portable": "17.6.0" } }, "stryker.regexmutators": { "type": "Project", "dependencies": { - "RegexParser": "[0.5.1, )" + "RegexParser": "0.5.1" } }, "Buildalyzer": { diff --git a/src/Stryker.Core/Stryker.Core/MutantFilters/BaselineMutantFilter.cs b/src/Stryker.Core/Stryker.Core/MutantFilters/BaselineMutantFilter.cs index b7b83af4f6..38b424c79e 100644 --- a/src/Stryker.Core/Stryker.Core/MutantFilters/BaselineMutantFilter.cs +++ b/src/Stryker.Core/Stryker.Core/MutantFilters/BaselineMutantFilter.cs @@ -109,6 +109,12 @@ private void SetMutantStatusToBaselineMutantStatus(JsonMutant baselineMutant, IE private async Task GetBaselineAsync() { + if (_options.BaselineRecreateEnabled) + { + _logger.LogInformation("Now running a complete test to establish a fresh baseline."); + + return null; + } var branchName = _gitInfoProvider.GetCurrentBranchName(); var baselineLocation = $"baseline/{branchName}"; diff --git a/src/Stryker.Core/Stryker.Core/Options/Inputs/BaselineCreateEnabledInput.cs b/src/Stryker.Core/Stryker.Core/Options/Inputs/BaselineCreateEnabledInput.cs index 23021fa75f..aebb47c497 100644 --- a/src/Stryker.Core/Stryker.Core/Options/Inputs/BaselineCreateEnabledInput.cs +++ b/src/Stryker.Core/Stryker.Core/Options/Inputs/BaselineCreateEnabledInput.cs @@ -1,6 +1,6 @@ namespace Stryker.Core.Options.Inputs { - public class BaselineCreateEnabledInput : Input + public class BaselineRereateEnabledInput : Input { public override bool Default => false; diff --git a/src/Stryker.Core/Stryker.Core/Options/StrykerInputs.cs b/src/Stryker.Core/Stryker.Core/Options/StrykerInputs.cs index 7bed2d998e..f592793bbd 100644 --- a/src/Stryker.Core/Stryker.Core/Options/StrykerInputs.cs +++ b/src/Stryker.Core/Stryker.Core/Options/StrykerInputs.cs @@ -9,7 +9,7 @@ public interface IStrykerInputs AdditionalTimeoutInput AdditionalTimeoutInput { get; init; } AzureFileStorageSasInput AzureFileStorageSasInput { get; init; } AzureFileStorageUrlInput AzureFileStorageUrlInput { get; init; } - BaselineCreateEnabledInput BaselineCreateEnabledInput { get; init; } + BaselineRereateEnabledInput BaselineRecreateEnabledInput { get; init; } BaselineProviderInput BaselineProviderInput { get; init; } BasePathInput BasePathInput { get; init; } ConcurrencyInput ConcurrencyInput { get; init; } @@ -82,7 +82,7 @@ public StrykerInputs(IFileSystem fileSystem = null) public TestProjectsInput TestProjectsInput { get; init; } = new(); public TestCaseFilterInput TestCaseFilterInput { get; init; } = new(); public ReportersInput ReportersInput { get; init; } = new(); - public BaselineCreateEnabledInput BaselineCreateEnabledInput { get; init; } = new(); + public BaselineRereateEnabledInput BaselineRecreateEnabledInput { get; init; } = new(); public WithBaselineInput WithBaselineInput { get; init; } = new(); public BaselineProviderInput BaselineProviderInput { get; init; } = new(); public AzureFileStorageUrlInput AzureFileStorageUrlInput { get; init; } = new(); @@ -112,7 +112,7 @@ public StrykerOptions ValidateAll() var basePath = BasePathInput.Validate(_fileSystem); var outputPath = OutputPathInput.Validate(_fileSystem); var reportFileNameInput = ReportFileNameInput.Validate(); - var baselineCreateEnabled = BaselineCreateEnabledInput.Validate(); + var baselineCreateEnabled = BaselineRecreateEnabledInput.Validate(); var withBaseline = WithBaselineInput.Validate(); var reporters = ReportersInput.Validate(withBaseline); var baselineProvider = BaselineProviderInput.Validate(reporters); @@ -161,7 +161,7 @@ public StrykerOptions ValidateAll() DiffIgnoreChanges = DiffIgnoreChangesInput.Validate(), AzureFileStorageSas = AzureFileStorageSasInput.Validate(baselineProvider), AzureFileStorageUrl = AzureFileStorageUrlInput.Validate(baselineProvider), - BaselineCreateEnabled = baselineCreateEnabled, + BaselineRecreateEnabled = baselineCreateEnabled, WithBaseline = withBaseline, BaselineProvider = baselineProvider, FallbackVersion = FallbackVersionInput.Validate(withBaseline, projectVersion, sinceTarget), diff --git a/src/Stryker.Core/Stryker.Core/Options/StrykerOptions.cs b/src/Stryker.Core/Stryker.Core/Options/StrykerOptions.cs index a43150bc55..5ec8be761d 100644 --- a/src/Stryker.Core/Stryker.Core/Options/StrykerOptions.cs +++ b/src/Stryker.Core/Stryker.Core/Options/StrykerOptions.cs @@ -111,7 +111,7 @@ public class StrykerOptions /// /// When true, a new baseline should be created. /// - public bool BaselineCreateEnabled { get; init; } + public bool BaselineRecreateEnabled { get; init; } /// /// When true, the baseline feature should be enabled. diff --git a/src/Stryker.Core/Stryker.Core/packages.lock.json b/src/Stryker.Core/Stryker.Core/packages.lock.json index 66eab2a82a..74c3f3ccb0 100644 --- a/src/Stryker.Core/Stryker.Core/packages.lock.json +++ b/src/Stryker.Core/Stryker.Core/packages.lock.json @@ -1726,14 +1726,14 @@ "stryker.datacollector": { "type": "Project", "dependencies": { - "Microsoft.TestPlatform.ObjectModel": "[17.6.0, )", - "Microsoft.TestPlatform.Portable": "[17.6.0, )" + "Microsoft.TestPlatform.ObjectModel": "17.6.0", + "Microsoft.TestPlatform.Portable": "17.6.0" } }, "stryker.regexmutators": { "type": "Project", "dependencies": { - "RegexParser": "[0.5.1, )" + "RegexParser": "0.5.1" } }, "RegexParser": { diff --git a/src/Stryker.RegexMutators/Stryker.RegexMutators.UnitTest/packages.lock.json b/src/Stryker.RegexMutators/Stryker.RegexMutators.UnitTest/packages.lock.json index c14a37ab8f..001ed8e2d9 100644 --- a/src/Stryker.RegexMutators/Stryker.RegexMutators.UnitTest/packages.lock.json +++ b/src/Stryker.RegexMutators/Stryker.RegexMutators.UnitTest/packages.lock.json @@ -1112,7 +1112,7 @@ "stryker.regexmutators": { "type": "Project", "dependencies": { - "RegexParser": "[0.5.1, )" + "RegexParser": "0.5.1" } }, "Microsoft.TestPlatform.ObjectModel": { From 4871f39a64d7da98e1918f34ef615e4a5aee1ca5 Mon Sep 17 00:00:00 2001 From: Richard Werkman Date: Fri, 9 Jun 2023 13:44:44 +0200 Subject: [PATCH 04/27] fix merge --- .../Stryker.CLI.UnitTest/packages.lock.json | 56 +++++++++---------- .../Stryker.CLI/packages.lock.json | 34 +++++------ .../Stryker.Core.UnitTest/packages.lock.json | 54 +++++++++--------- .../Stryker.Core/packages.lock.json | 26 ++++----- 4 files changed, 85 insertions(+), 85 deletions(-) diff --git a/src/Stryker.CLI/Stryker.CLI.UnitTest/packages.lock.json b/src/Stryker.CLI/Stryker.CLI.UnitTest/packages.lock.json index 942c95dd55..a719c2b914 100644 --- a/src/Stryker.CLI/Stryker.CLI.UnitTest/packages.lock.json +++ b/src/Stryker.CLI/Stryker.CLI.UnitTest/packages.lock.json @@ -28,12 +28,12 @@ }, "Microsoft.NET.Test.Sdk": { "type": "Direct", - "requested": "[17.6.0, )", - "resolved": "17.6.0", - "contentHash": "tHyg4C6c89QvLv6Utz3xKlba4EeoyJyIz59Q1NrjRENV7gfGnSE6I+sYPIbVOzQttoo2zpHDgOK/p6Hw2OlD7A==", + "requested": "[17.6.2, )", + "resolved": "17.6.2", + "contentHash": "+WFxuoFVBG0aewD9Psw+1I90kaRToQgMIzK20xNVRO4QRWR9Bou3qGefrZvMZ/xTC+6bAmZppFbpPbiHDzrPyg==", "dependencies": { - "Microsoft.CodeCoverage": "17.6.0", - "Microsoft.TestPlatform.TestHost": "17.6.0" + "Microsoft.CodeCoverage": "17.6.2", + "Microsoft.TestPlatform.TestHost": "17.6.2" } }, "Moq": { @@ -210,8 +210,8 @@ }, "Microsoft.CodeCoverage": { "type": "Transitive", - "resolved": "17.6.0", - "contentHash": "5v2GwzpR7JEuQUzupjx3zLwn2FutADW/weLzLt726DR3WXxsM+ICPoJG6pxuKFsumtZp890UrVuudTUhsE8Qyg==" + "resolved": "17.6.2", + "contentHash": "t+DjPlq7GIxIkOK/jiTmNeiEMVkfVCynBEZyV+IMg2ro43NugKExng+7a04R1fBLi+d6voxjeDxL2ozdl+XyVg==" }, "Microsoft.DotNet.PlatformAbstractions": { "type": "Transitive", @@ -353,10 +353,10 @@ }, "Microsoft.TestPlatform.TestHost": { "type": "Transitive", - "resolved": "17.6.0", - "contentHash": "7YdgUcIeCPVKLC7n7LNKDiEHWc7z3brkkYPdUbDnFsvf6WvY9UfzS0VSUJ8P2NgN0CDSD223GCJFSjSBLZRqOQ==", + "resolved": "17.6.2", + "contentHash": "WszrF1CoG+Y2bA4WJFxlaPADQCWUuNP6TCxVRuScmP6DQsNvDDuOO9XiUxCA+wPmNOSyWVh9EGrPu7JoUpf2gA==", "dependencies": { - "Microsoft.TestPlatform.ObjectModel": "17.6.0", + "Microsoft.TestPlatform.ObjectModel": "17.6.2", "Newtonsoft.Json": "13.0.1" } }, @@ -1599,7 +1599,7 @@ "McMaster.Extensions.CommandLineUtils": "4.0.2", "NuGet.Protocol": "6.6.0", "YamlDotNet": "13.1.0", - "stryker": "3.9.0" + "stryker": "3.9.1" } }, "stryker": { @@ -1612,10 +1612,10 @@ "LibGit2Sharp": "0.27.2", "Microsoft.CodeAnalysis.CSharp": "4.6.0", "Microsoft.Extensions.Logging": "7.0.0", - "Microsoft.TestPlatform": "17.6.0", - "Microsoft.TestPlatform.ObjectModel": "17.6.0", - "Microsoft.TestPlatform.Portable": "17.6.0", - "Microsoft.TestPlatform.TranslationLayer": "17.6.0", + "Microsoft.TestPlatform": "17.6.2", + "Microsoft.TestPlatform.ObjectModel": "17.6.2", + "Microsoft.TestPlatform.Portable": "17.6.2", + "Microsoft.TestPlatform.TranslationLayer": "17.6.2", "Microsoft.Web.LibraryManager.Build": "2.1.175", "Mono.Cecil": "0.11.5", "NuGet.Frameworks": "6.6.0", @@ -1752,31 +1752,31 @@ }, "Microsoft.TestPlatform": { "type": "CentralTransitive", - "requested": "[17.6.0, )", - "resolved": "17.6.0", - "contentHash": "rtDdZ3XQ/G/N2AcxsRfz7YWzYx65ywFuQFVHYhVT6c4vlV85PxqZCbK1rgTAo9HsnLTIrUN6ueXt2C+rKDGxaQ==" + "requested": "[17.6.2, )", + "resolved": "17.6.2", + "contentHash": "B52233J36jQ00hrXlVfdzFEukY57oz9Y+yg8/34g7y6JUZP5zPrPwlfo6NhltCIDYbXV1uLWI9l7CHfk608SQw==" }, "Microsoft.TestPlatform.ObjectModel": { "type": "CentralTransitive", - "requested": "[17.6.0, )", - "resolved": "17.6.0", - "contentHash": "AA/rrf5zwC5/OBLEOajkhjbVTM3SvxRXy8kcQ8e4mJKojbyZvqqhpfNg362N9vXU94DLg9NUTFOAnoYVT0pTJw==", + "requested": "[17.6.2, )", + "resolved": "17.6.2", + "contentHash": "I3S/oELDAe/ckFltBnPb0PV+gADbpc8n0yGTtYfTd7q1hd0cAZKn/FrYoegA/rGws8fEFyJD/2PB6uq+nIjWsg==", "dependencies": { - "NuGet.Frameworks": "5.11.0", + "NuGet.Frameworks": "6.5.0", "System.Reflection.Metadata": "1.6.0" } }, "Microsoft.TestPlatform.Portable": { "type": "CentralTransitive", - "requested": "[17.6.0, )", - "resolved": "17.6.0", - "contentHash": "gjn/4zTycOiCUkdmC2VhnvbPOlr6Z/s/MSl7qVdEbD/O7vIWZzA3eAmauyMt2Tf+589UgaMJtLk8sTqxFPm03Q==" + "requested": "[17.6.2, )", + "resolved": "17.6.2", + "contentHash": "APkoUyCYABx3aQ/pfGAad8x7W49837YctPhBYhmknLQOnhWp7F+QjoFmgp/0u+fBuiMqVgvwQABxofe/Zkmusg==" }, "Microsoft.TestPlatform.TranslationLayer": { "type": "CentralTransitive", - "requested": "[17.6.0, )", - "resolved": "17.6.0", - "contentHash": "8v3XHqzLEuJQzkyomjzLagqn1qvQR33vO3lYfz5cX7hf7x5/IJ5c9w2R8vaAGaDu3srPIE5l7I6QaCF/5QXzqw==", + "requested": "[17.6.2, )", + "resolved": "17.6.2", + "contentHash": "Ycs7DmH8v6dmJmKhwqUcVUMSLk8hUdETQK47w7XE0PaNjgPUAnFVRCnOF3PSlm6MerETjpJCQdYxOXz04/RjMg==", "dependencies": { "NETStandard.Library": "2.0.0" } diff --git a/src/Stryker.CLI/Stryker.CLI/packages.lock.json b/src/Stryker.CLI/Stryker.CLI/packages.lock.json index de82ff4887..9f75c506ba 100644 --- a/src/Stryker.CLI/Stryker.CLI/packages.lock.json +++ b/src/Stryker.CLI/Stryker.CLI/packages.lock.json @@ -1447,10 +1447,10 @@ "LibGit2Sharp": "0.27.2", "Microsoft.CodeAnalysis.CSharp": "4.6.0", "Microsoft.Extensions.Logging": "7.0.0", - "Microsoft.TestPlatform": "17.6.0", - "Microsoft.TestPlatform.ObjectModel": "17.6.0", - "Microsoft.TestPlatform.Portable": "17.6.0", - "Microsoft.TestPlatform.TranslationLayer": "17.6.0", + "Microsoft.TestPlatform": "17.6.2", + "Microsoft.TestPlatform.ObjectModel": "17.6.2", + "Microsoft.TestPlatform.Portable": "17.6.2", + "Microsoft.TestPlatform.TranslationLayer": "17.6.2", "Microsoft.Web.LibraryManager.Build": "2.1.175", "Mono.Cecil": "0.11.5", "NuGet.Frameworks": "6.6.0", @@ -1578,31 +1578,31 @@ }, "Microsoft.TestPlatform": { "type": "CentralTransitive", - "requested": "[17.6.0, )", - "resolved": "17.6.0", - "contentHash": "rtDdZ3XQ/G/N2AcxsRfz7YWzYx65ywFuQFVHYhVT6c4vlV85PxqZCbK1rgTAo9HsnLTIrUN6ueXt2C+rKDGxaQ==" + "requested": "[17.6.2, )", + "resolved": "17.6.2", + "contentHash": "B52233J36jQ00hrXlVfdzFEukY57oz9Y+yg8/34g7y6JUZP5zPrPwlfo6NhltCIDYbXV1uLWI9l7CHfk608SQw==" }, "Microsoft.TestPlatform.ObjectModel": { "type": "CentralTransitive", - "requested": "[17.6.0, )", - "resolved": "17.6.0", - "contentHash": "AA/rrf5zwC5/OBLEOajkhjbVTM3SvxRXy8kcQ8e4mJKojbyZvqqhpfNg362N9vXU94DLg9NUTFOAnoYVT0pTJw==", + "requested": "[17.6.2, )", + "resolved": "17.6.2", + "contentHash": "I3S/oELDAe/ckFltBnPb0PV+gADbpc8n0yGTtYfTd7q1hd0cAZKn/FrYoegA/rGws8fEFyJD/2PB6uq+nIjWsg==", "dependencies": { - "NuGet.Frameworks": "5.11.0", + "NuGet.Frameworks": "6.5.0", "System.Reflection.Metadata": "1.6.0" } }, "Microsoft.TestPlatform.Portable": { "type": "CentralTransitive", - "requested": "[17.6.0, )", - "resolved": "17.6.0", - "contentHash": "gjn/4zTycOiCUkdmC2VhnvbPOlr6Z/s/MSl7qVdEbD/O7vIWZzA3eAmauyMt2Tf+589UgaMJtLk8sTqxFPm03Q==" + "requested": "[17.6.2, )", + "resolved": "17.6.2", + "contentHash": "APkoUyCYABx3aQ/pfGAad8x7W49837YctPhBYhmknLQOnhWp7F+QjoFmgp/0u+fBuiMqVgvwQABxofe/Zkmusg==" }, "Microsoft.TestPlatform.TranslationLayer": { "type": "CentralTransitive", - "requested": "[17.6.0, )", - "resolved": "17.6.0", - "contentHash": "8v3XHqzLEuJQzkyomjzLagqn1qvQR33vO3lYfz5cX7hf7x5/IJ5c9w2R8vaAGaDu3srPIE5l7I6QaCF/5QXzqw==", + "requested": "[17.6.2, )", + "resolved": "17.6.2", + "contentHash": "Ycs7DmH8v6dmJmKhwqUcVUMSLk8hUdETQK47w7XE0PaNjgPUAnFVRCnOF3PSlm6MerETjpJCQdYxOXz04/RjMg==", "dependencies": { "NETStandard.Library": "2.0.0" } diff --git a/src/Stryker.Core/Stryker.Core.UnitTest/packages.lock.json b/src/Stryker.Core/Stryker.Core.UnitTest/packages.lock.json index 2b505533b4..2745dbda7b 100644 --- a/src/Stryker.Core/Stryker.Core.UnitTest/packages.lock.json +++ b/src/Stryker.Core/Stryker.Core.UnitTest/packages.lock.json @@ -37,12 +37,12 @@ }, "Microsoft.NET.Test.Sdk": { "type": "Direct", - "requested": "[17.6.0, )", - "resolved": "17.6.0", - "contentHash": "tHyg4C6c89QvLv6Utz3xKlba4EeoyJyIz59Q1NrjRENV7gfGnSE6I+sYPIbVOzQttoo2zpHDgOK/p6Hw2OlD7A==", + "requested": "[17.6.2, )", + "resolved": "17.6.2", + "contentHash": "+WFxuoFVBG0aewD9Psw+1I90kaRToQgMIzK20xNVRO4QRWR9Bou3qGefrZvMZ/xTC+6bAmZppFbpPbiHDzrPyg==", "dependencies": { - "Microsoft.CodeCoverage": "17.6.0", - "Microsoft.TestPlatform.TestHost": "17.6.0" + "Microsoft.CodeCoverage": "17.6.2", + "Microsoft.TestPlatform.TestHost": "17.6.2" } }, "Moq": { @@ -237,8 +237,8 @@ }, "Microsoft.CodeCoverage": { "type": "Transitive", - "resolved": "17.6.0", - "contentHash": "5v2GwzpR7JEuQUzupjx3zLwn2FutADW/weLzLt726DR3WXxsM+ICPoJG6pxuKFsumtZp890UrVuudTUhsE8Qyg==" + "resolved": "17.6.2", + "contentHash": "t+DjPlq7GIxIkOK/jiTmNeiEMVkfVCynBEZyV+IMg2ro43NugKExng+7a04R1fBLi+d6voxjeDxL2ozdl+XyVg==" }, "Microsoft.DotNet.PlatformAbstractions": { "type": "Transitive", @@ -380,10 +380,10 @@ }, "Microsoft.TestPlatform.TestHost": { "type": "Transitive", - "resolved": "17.6.0", - "contentHash": "7YdgUcIeCPVKLC7n7LNKDiEHWc7z3brkkYPdUbDnFsvf6WvY9UfzS0VSUJ8P2NgN0CDSD223GCJFSjSBLZRqOQ==", + "resolved": "17.6.2", + "contentHash": "WszrF1CoG+Y2bA4WJFxlaPADQCWUuNP6TCxVRuScmP6DQsNvDDuOO9XiUxCA+wPmNOSyWVh9EGrPu7JoUpf2gA==", "dependencies": { - "Microsoft.TestPlatform.ObjectModel": "17.6.0", + "Microsoft.TestPlatform.ObjectModel": "17.6.2", "Newtonsoft.Json": "13.0.1" } }, @@ -1587,10 +1587,10 @@ "LibGit2Sharp": "0.27.2", "Microsoft.CodeAnalysis.CSharp": "4.6.0", "Microsoft.Extensions.Logging": "7.0.0", - "Microsoft.TestPlatform": "17.6.0", - "Microsoft.TestPlatform.ObjectModel": "17.6.0", - "Microsoft.TestPlatform.Portable": "17.6.0", - "Microsoft.TestPlatform.TranslationLayer": "17.6.0", + "Microsoft.TestPlatform": "17.6.2", + "Microsoft.TestPlatform.ObjectModel": "17.6.2", + "Microsoft.TestPlatform.Portable": "17.6.2", + "Microsoft.TestPlatform.TranslationLayer": "17.6.2", "Microsoft.Web.LibraryManager.Build": "2.1.175", "Mono.Cecil": "0.11.5", "NuGet.Frameworks": "6.6.0", @@ -1718,31 +1718,31 @@ }, "Microsoft.TestPlatform": { "type": "CentralTransitive", - "requested": "[17.6.0, )", - "resolved": "17.6.0", - "contentHash": "rtDdZ3XQ/G/N2AcxsRfz7YWzYx65ywFuQFVHYhVT6c4vlV85PxqZCbK1rgTAo9HsnLTIrUN6ueXt2C+rKDGxaQ==" + "requested": "[17.6.2, )", + "resolved": "17.6.2", + "contentHash": "B52233J36jQ00hrXlVfdzFEukY57oz9Y+yg8/34g7y6JUZP5zPrPwlfo6NhltCIDYbXV1uLWI9l7CHfk608SQw==" }, "Microsoft.TestPlatform.ObjectModel": { "type": "CentralTransitive", - "requested": "[17.6.0, )", - "resolved": "17.6.0", - "contentHash": "AA/rrf5zwC5/OBLEOajkhjbVTM3SvxRXy8kcQ8e4mJKojbyZvqqhpfNg362N9vXU94DLg9NUTFOAnoYVT0pTJw==", + "requested": "[17.6.2, )", + "resolved": "17.6.2", + "contentHash": "I3S/oELDAe/ckFltBnPb0PV+gADbpc8n0yGTtYfTd7q1hd0cAZKn/FrYoegA/rGws8fEFyJD/2PB6uq+nIjWsg==", "dependencies": { - "NuGet.Frameworks": "5.11.0", + "NuGet.Frameworks": "6.5.0", "System.Reflection.Metadata": "1.6.0" } }, "Microsoft.TestPlatform.Portable": { "type": "CentralTransitive", - "requested": "[17.6.0, )", - "resolved": "17.6.0", - "contentHash": "gjn/4zTycOiCUkdmC2VhnvbPOlr6Z/s/MSl7qVdEbD/O7vIWZzA3eAmauyMt2Tf+589UgaMJtLk8sTqxFPm03Q==" + "requested": "[17.6.2, )", + "resolved": "17.6.2", + "contentHash": "APkoUyCYABx3aQ/pfGAad8x7W49837YctPhBYhmknLQOnhWp7F+QjoFmgp/0u+fBuiMqVgvwQABxofe/Zkmusg==" }, "Microsoft.TestPlatform.TranslationLayer": { "type": "CentralTransitive", - "requested": "[17.6.0, )", - "resolved": "17.6.0", - "contentHash": "8v3XHqzLEuJQzkyomjzLagqn1qvQR33vO3lYfz5cX7hf7x5/IJ5c9w2R8vaAGaDu3srPIE5l7I6QaCF/5QXzqw==", + "requested": "[17.6.2, )", + "resolved": "17.6.2", + "contentHash": "Ycs7DmH8v6dmJmKhwqUcVUMSLk8hUdETQK47w7XE0PaNjgPUAnFVRCnOF3PSlm6MerETjpJCQdYxOXz04/RjMg==", "dependencies": { "NETStandard.Library": "2.0.0" } diff --git a/src/Stryker.Core/Stryker.Core/packages.lock.json b/src/Stryker.Core/Stryker.Core/packages.lock.json index 81513e8858..283916cef0 100644 --- a/src/Stryker.Core/Stryker.Core/packages.lock.json +++ b/src/Stryker.Core/Stryker.Core/packages.lock.json @@ -112,31 +112,31 @@ }, "Microsoft.TestPlatform": { "type": "Direct", - "requested": "[17.6.0, )", - "resolved": "17.6.0", - "contentHash": "rtDdZ3XQ/G/N2AcxsRfz7YWzYx65ywFuQFVHYhVT6c4vlV85PxqZCbK1rgTAo9HsnLTIrUN6ueXt2C+rKDGxaQ==" + "requested": "[17.6.2, )", + "resolved": "17.6.2", + "contentHash": "B52233J36jQ00hrXlVfdzFEukY57oz9Y+yg8/34g7y6JUZP5zPrPwlfo6NhltCIDYbXV1uLWI9l7CHfk608SQw==" }, "Microsoft.TestPlatform.ObjectModel": { "type": "Direct", - "requested": "[17.6.0, )", - "resolved": "17.6.0", - "contentHash": "AA/rrf5zwC5/OBLEOajkhjbVTM3SvxRXy8kcQ8e4mJKojbyZvqqhpfNg362N9vXU94DLg9NUTFOAnoYVT0pTJw==", + "requested": "[17.6.2, )", + "resolved": "17.6.2", + "contentHash": "I3S/oELDAe/ckFltBnPb0PV+gADbpc8n0yGTtYfTd7q1hd0cAZKn/FrYoegA/rGws8fEFyJD/2PB6uq+nIjWsg==", "dependencies": { - "NuGet.Frameworks": "5.11.0", + "NuGet.Frameworks": "6.5.0", "System.Reflection.Metadata": "1.6.0" } }, "Microsoft.TestPlatform.Portable": { "type": "Direct", - "requested": "[17.6.0, )", - "resolved": "17.6.0", - "contentHash": "gjn/4zTycOiCUkdmC2VhnvbPOlr6Z/s/MSl7qVdEbD/O7vIWZzA3eAmauyMt2Tf+589UgaMJtLk8sTqxFPm03Q==" + "requested": "[17.6.2, )", + "resolved": "17.6.2", + "contentHash": "APkoUyCYABx3aQ/pfGAad8x7W49837YctPhBYhmknLQOnhWp7F+QjoFmgp/0u+fBuiMqVgvwQABxofe/Zkmusg==" }, "Microsoft.TestPlatform.TranslationLayer": { "type": "Direct", - "requested": "[17.6.0, )", - "resolved": "17.6.0", - "contentHash": "8v3XHqzLEuJQzkyomjzLagqn1qvQR33vO3lYfz5cX7hf7x5/IJ5c9w2R8vaAGaDu3srPIE5l7I6QaCF/5QXzqw==", + "requested": "[17.6.2, )", + "resolved": "17.6.2", + "contentHash": "Ycs7DmH8v6dmJmKhwqUcVUMSLk8hUdETQK47w7XE0PaNjgPUAnFVRCnOF3PSlm6MerETjpJCQdYxOXz04/RjMg==", "dependencies": { "NETStandard.Library": "2.0.0" } From 36a4ce9812dc6b43dc374b526b6492cea259a0a9 Mon Sep 17 00:00:00 2001 From: Richard Werkman Date: Fri, 9 Jun 2023 16:48:12 +0200 Subject: [PATCH 05/27] try to enable baseline by command --- src/Stryker.CLI/Stryker.CLI/FileConfigReader.cs | 2 +- src/Stryker.CLI/Stryker.CLI/StrykerCLI.cs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Stryker.CLI/Stryker.CLI/FileConfigReader.cs b/src/Stryker.CLI/Stryker.CLI/FileConfigReader.cs index 388d348edc..284c51685b 100644 --- a/src/Stryker.CLI/Stryker.CLI/FileConfigReader.cs +++ b/src/Stryker.CLI/Stryker.CLI/FileConfigReader.cs @@ -25,7 +25,7 @@ public static void DeserializeConfig(string configFilePath, IStrykerInputs input config.Since is not null && (config.Since.Enabled.HasValue && config.Since.Enabled.Value); - inputs.WithBaselineInput.SuppliedInput = + inputs.WithBaselineInput.SuppliedInput ??= config.Baseline is not null && (config.Baseline.Enabled.HasValue && config.Baseline.Enabled.Value); diff --git a/src/Stryker.CLI/Stryker.CLI/StrykerCLI.cs b/src/Stryker.CLI/Stryker.CLI/StrykerCLI.cs index 77163863da..5e1cc6780e 100644 --- a/src/Stryker.CLI/Stryker.CLI/StrykerCLI.cs +++ b/src/Stryker.CLI/Stryker.CLI/StrykerCLI.cs @@ -59,12 +59,12 @@ public int Run(string[] args) app.Command("baseline", baselineCmd => { baselineCmd.Description = "Enables the baseline feature"; - inputs.WithBaselineInput.SuppliedInput = true; baselineCmd.Command("recreate", createCmd => { createCmd.OnExecute(() => { + inputs.WithBaselineInput.SuppliedInput = true; createCmd.Description = "Creates a new baseline by doing a full stryker run"; inputs.BaselineRecreateEnabledInput.SuppliedInput = true; return StartApp(inputs, args, app, cmdConfigReader); @@ -72,6 +72,7 @@ public int Run(string[] args) }); baselineCmd.OnExecute(() => { + inputs.WithBaselineInput.SuppliedInput = true; return StartApp(inputs, args, app, cmdConfigReader); }); }); From e180534cd2a550d4396ce1bfb191ab1210eb2824 Mon Sep 17 00:00:00 2001 From: Richard Werkman Date: Fri, 23 Jun 2023 09:56:41 +0200 Subject: [PATCH 06/27] Fixed command --- src/Stryker.CLI/Stryker.CLI/StrykerCLI.cs | 8 +++- .../MutantFilters/SinceMutantFilter.cs | 46 +++++++++++-------- 2 files changed, 33 insertions(+), 21 deletions(-) diff --git a/src/Stryker.CLI/Stryker.CLI/StrykerCLI.cs b/src/Stryker.CLI/Stryker.CLI/StrykerCLI.cs index 5e1cc6780e..a43f619a47 100644 --- a/src/Stryker.CLI/Stryker.CLI/StrykerCLI.cs +++ b/src/Stryker.CLI/Stryker.CLI/StrykerCLI.cs @@ -59,9 +59,12 @@ public int Run(string[] args) app.Command("baseline", baselineCmd => { baselineCmd.Description = "Enables the baseline feature"; + cmdConfigReader.RegisterCommandLineOptions(baselineCmd, inputs); baselineCmd.Command("recreate", createCmd => { + cmdConfigReader.RegisterCommandLineOptions(createCmd, inputs); + createCmd.OnExecute(() => { inputs.WithBaselineInput.SuppliedInput = true; @@ -94,7 +97,10 @@ public int Run(string[] args) { Console.Error.WriteLine(); Console.Error.WriteLine("Did you mean this?"); - Console.Error.WriteLine(" " + uex.NearestMatches.First()); + foreach (var nearMatch in uex.NearestMatches) + { + Console.Error.WriteLine(" " + nearMatch); + } } return ExitCodes.OtherError; diff --git a/src/Stryker.Core/Stryker.Core/MutantFilters/SinceMutantFilter.cs b/src/Stryker.Core/Stryker.Core/MutantFilters/SinceMutantFilter.cs index 04cc731936..9cc6ec08e8 100644 --- a/src/Stryker.Core/Stryker.Core/MutantFilters/SinceMutantFilter.cs +++ b/src/Stryker.Core/Stryker.Core/MutantFilters/SinceMutantFilter.cs @@ -6,6 +6,7 @@ using Stryker.Core.Mutants; using Stryker.Core.Options; using Stryker.Core.ProjectComponents; +using System; using System.Collections.Generic; using System.Linq; @@ -26,26 +27,6 @@ public SinceMutantFilter(IDiffProvider diffProvider = null) _diffResult = diffProvider.ScanDiff(); _tests = diffProvider.Tests; - - if (_diffResult != null) - { - _logger.LogInformation("{0} files changed", (_diffResult.ChangedSourceFiles?.Count ?? 0) + (_diffResult.ChangedTestFiles?.Count ?? 0)); - - if (_diffResult.ChangedSourceFiles != null) - { - foreach (var changedFile in _diffResult.ChangedSourceFiles) - { - _logger.LogInformation("Changed file {0}", changedFile); - } - } - if (_diffResult.ChangedTestFiles != null) - { - foreach (var changedFile in _diffResult.ChangedTestFiles) - { - _logger.LogInformation("Changed test file {0}", changedFile); - } - } - } } public IEnumerable FilterMutants(IEnumerable mutants, IReadOnlyFileLeaf file, StrykerOptions options) @@ -78,9 +59,34 @@ public IEnumerable FilterMutants(IEnumerable mutants, IReadOnlyF filteredMutants = ResetMutantStatusForChangedTests(mutants); } + LogChangedFiles(options); + return filteredMutants; } + private void LogChangedFiles(StrykerOptions options) + { + if (_diffResult != null && !options.BaselineRecreateEnabled) + { + _logger.LogInformation("{0} files changed", (_diffResult.ChangedSourceFiles?.Count ?? 0) + (_diffResult.ChangedTestFiles?.Count ?? 0)); + + if (_diffResult.ChangedSourceFiles != null) + { + foreach (var changedFile in _diffResult.ChangedSourceFiles) + { + _logger.LogInformation("Changed file {0}", changedFile); + } + } + if (_diffResult.ChangedTestFiles != null) + { + foreach (var changedFile in _diffResult.ChangedTestFiles) + { + _logger.LogInformation("Changed test file {0}", changedFile); + } + } + } + } + private IEnumerable SetNotRunMutantsToIgnored(IEnumerable mutants) { foreach (var mutant in mutants.Where(m => m.ResultStatus == MutantStatus.Pending || m.ResultStatus == MutantStatus.NoCoverage)) From f1f6cf3ab3c9f6187fa32cee884a7d08dac1c3d2 Mon Sep 17 00:00:00 2001 From: Richard Werkman Date: Fri, 23 Jun 2023 11:20:33 +0200 Subject: [PATCH 07/27] Fix mutation level --- .../Mutators/NullCoalescingExpressionMutatorTests.cs | 2 +- .../Stryker.Core/Mutators/BinaryExpressionMutator.cs | 1 - .../Stryker.Core/Mutators/NullCoalescingExpressionMutator.cs | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Stryker.Core/Stryker.Core.UnitTest/Mutators/NullCoalescingExpressionMutatorTests.cs b/src/Stryker.Core/Stryker.Core.UnitTest/Mutators/NullCoalescingExpressionMutatorTests.cs index 6b280a97e0..5accbaf1e5 100644 --- a/src/Stryker.Core/Stryker.Core.UnitTest/Mutators/NullCoalescingExpressionMutatorTests.cs +++ b/src/Stryker.Core/Stryker.Core.UnitTest/Mutators/NullCoalescingExpressionMutatorTests.cs @@ -13,7 +13,7 @@ public class NullCoalescingExpressionMutatorTests : TestBase public void ShouldBeMutationLevelStandard() { var target = new NullCoalescingExpressionMutator(); - target.MutationLevel.ShouldBe(MutationLevel.Basic); + target.MutationLevel.ShouldBe(MutationLevel.Standard); } [Fact] diff --git a/src/Stryker.Core/Stryker.Core/Mutators/BinaryExpressionMutator.cs b/src/Stryker.Core/Stryker.Core/Mutators/BinaryExpressionMutator.cs index 1a05d23e7f..3eb8a995b2 100644 --- a/src/Stryker.Core/Stryker.Core/Mutators/BinaryExpressionMutator.cs +++ b/src/Stryker.Core/Stryker.Core/Mutators/BinaryExpressionMutator.cs @@ -18,7 +18,6 @@ public MutationData(Mutator mutator, params SyntaxKind[] kindsToMutate) Mutator = mutator; KindsToMutate = kindsToMutate; } - } private static readonly Dictionary _kindsToMutate = new Dictionary() diff --git a/src/Stryker.Core/Stryker.Core/Mutators/NullCoalescingExpressionMutator.cs b/src/Stryker.Core/Stryker.Core/Mutators/NullCoalescingExpressionMutator.cs index 22c85a4ca3..3002f83666 100644 --- a/src/Stryker.Core/Stryker.Core/Mutators/NullCoalescingExpressionMutator.cs +++ b/src/Stryker.Core/Stryker.Core/Mutators/NullCoalescingExpressionMutator.cs @@ -8,7 +8,7 @@ namespace Stryker.Core.Mutators { public class NullCoalescingExpressionMutator : MutatorBase, IMutator { - public override MutationLevel MutationLevel => MutationLevel.Basic; + public override MutationLevel MutationLevel => MutationLevel.Standard; public override IEnumerable ApplyMutations(BinaryExpressionSyntax node) { From e44bb01fe3b07ba064f61331dadfd165ca387227 Mon Sep 17 00:00:00 2001 From: Richard Werkman Date: Fri, 23 Jun 2023 15:04:05 +0200 Subject: [PATCH 08/27] Remove using --- .../Stryker.Core/MutantFilters/SinceMutantFilter.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Stryker.Core/Stryker.Core/MutantFilters/SinceMutantFilter.cs b/src/Stryker.Core/Stryker.Core/MutantFilters/SinceMutantFilter.cs index 9cc6ec08e8..8eb4ad8c4b 100644 --- a/src/Stryker.Core/Stryker.Core/MutantFilters/SinceMutantFilter.cs +++ b/src/Stryker.Core/Stryker.Core/MutantFilters/SinceMutantFilter.cs @@ -1,4 +1,6 @@ +using System.Collections.Generic; +using System.Linq; using Microsoft.CodeAnalysis; using Microsoft.Extensions.Logging; using Stryker.Core.DiffProviders; @@ -6,9 +8,6 @@ using Stryker.Core.Mutants; using Stryker.Core.Options; using Stryker.Core.ProjectComponents; -using System; -using System.Collections.Generic; -using System.Linq; namespace Stryker.Core.MutantFilters { From e1b4d1493448d6cdb091640b0b370b933e6c5484 Mon Sep 17 00:00:00 2001 From: Richard Werkman Date: Fri, 15 Sep 2023 16:04:40 +0200 Subject: [PATCH 09/27] Update docs + try to add target option to command --- docs/configuration.md | 31 +++++++++++++------ .../CommandLineConfigReader.cs | 4 +-- .../GroupedHelpTextGenerator.cs | 2 +- src/Stryker.CLI/Stryker.CLI/StrykerCLI.cs | 24 ++++++++++++-- .../Options/Inputs/BaselineTargetInput.cs | 24 ++++++++++++++ 5 files changed, 71 insertions(+), 14 deletions(-) create mode 100644 src/Stryker.Core/Stryker.Core/Options/Inputs/BaselineTargetInput.cs diff --git a/docs/configuration.md b/docs/configuration.md index 94350a5068..dee50213d2 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -471,31 +471,36 @@ Use [globbing syntax](https://en.wikipedia.org/wiki/Glob_(programming)) for wild ### `with-baseline` <`flag`> [`:committish`] -Default: `false` -Command line: `--with-baseline:feat-2` +Default: `false` +Command line: `dotnet baseline:feat-2` Config file: `"baseline": { }` Enabling `with-baseline` saves the mutation report to a storage location such as the filesystem. The mutation report is loaded at the start of the next mutation run. Any changed source code or unit test results in a reset of the mutants affected by the change. For unchanged mutants the previous result is reused. This feature expands on the [since](#since-flag-committish) feature by providing you with a full report after a partial mutation testrun. The report name is based on the current branch name or the [project-info.version](#project-infoversion-committish). -Set the diffing target on the command line by passing a committish with the since flag. -Set the diffing target in the config file by setting the [since target](#sincetarget-committish) option. - *\* This feature automatically enables the [since](#since-flag-committish) feature.* +### `target` <`string`> + +Default: `false` +Command line: `dotnet baseline --target feat-2` +Config file: `"baseline": { "target": "feat-2" }` + +Set the target on the command line by passing a committish with the baseline target option. + ### `baseline.enabled` <`flag`> -Default: `null` -Command line: `N/A` +Default: `null` +Command line: `N/A` Config file: `"baseline": { "enabled": false }` Enable or disable [with-baseline](#with-baseline-flag-committish). If the enabled property is not set but the `baseline` object exists in the config file it is assumed to be enabled. Use this option to (temporarily) disable `with-baseline` without having to delete the other baseline configuration. ### `baseline.fallback-version` <`string`> -Default: [since-target](#since-flag-committish) -Command line: `N/A` +Default: [since-target](#since-flag-committish) +Command line: `N/A` Config file: `"baseline": { "fallback-version": 'develop' }` When [with-baseline](#with-baseline-flag-committish) is enabled and Stryker cannot find an existing report for the current branch the fallback version is used. When Stryker is still unable to find a baseline we will do a complete instead of partial testrun. The complete testrun will then be saved as the new baseline for the next mutation testrun. @@ -570,6 +575,14 @@ Config file: `N/A` When using the azure file storage [provider](#baselineprovider-string) you must pass credentials for the fileshare to Stryker. For authentication with the azure fileshare we support Shared Access Signatures. For more information on how to configure a SAS check the [Azure documentation](https://docs.microsoft.com/en-us/azure/storage/common/storage-sas-overview). +### `baseline recreate` <`flag`> + +Default: `false` +Command line: `dotnet baseline recreate` +Config file: `N/A` + +Sometimes your baseline can get corrupted or out of touch with reality. In that case the baseline can be recreated using this command. This will test all mutations in your project and save the result as the new baseline. + ## Troubleshooting ### `verbosity` <`log-level`> diff --git a/src/Stryker.CLI/Stryker.CLI/CommandLineConfig/CommandLineConfigReader.cs b/src/Stryker.CLI/Stryker.CLI/CommandLineConfig/CommandLineConfigReader.cs index b15493cd63..1ff5924ffa 100644 --- a/src/Stryker.CLI/Stryker.CLI/CommandLineConfig/CommandLineConfigReader.cs +++ b/src/Stryker.CLI/Stryker.CLI/CommandLineConfig/CommandLineConfigReader.cs @@ -143,7 +143,7 @@ private void PrepareCliOptions(IStrykerInputs inputs) AddCliInput(inputs.DevModeInput, "dev-mode", null, optionType: CommandOptionType.NoValue, category: InputCategory.Misc); } - private void RegisterCliInput(CommandLineApplication app, CliInput option) + public void RegisterCliInput(CommandLineApplication app, CliInput option) { var argumentHint = option.OptionType switch { @@ -178,7 +178,7 @@ private CliInput AddCliOnlyInput(string argumentName, string argumentShortName, return cliOption; } - private void AddCliInput(IInput input, string argumentName, string argumentShortName, + public void AddCliInput(IInput input, string argumentName, string argumentShortName, CommandOptionType optionType = CommandOptionType.SingleValue, InputCategory category = InputCategory.Generic, string argumentHint = null) { var cliOption = new CliInput diff --git a/src/Stryker.CLI/Stryker.CLI/CommandLineConfig/GroupedHelpTextGenerator.cs b/src/Stryker.CLI/Stryker.CLI/CommandLineConfig/GroupedHelpTextGenerator.cs index fa46ec79da..5beb947f72 100644 --- a/src/Stryker.CLI/Stryker.CLI/CommandLineConfig/GroupedHelpTextGenerator.cs +++ b/src/Stryker.CLI/Stryker.CLI/CommandLineConfig/GroupedHelpTextGenerator.cs @@ -7,7 +7,7 @@ namespace Stryker.CLI { - [ExcludeFromCodeCoverage] // Not worth the effort to test + [ExcludeFromCodeCoverage(Justification = "Not worth the effort to test")] internal class GroupedHelpTextGenerator : DefaultHelpTextGenerator { protected override void GenerateOptions(CommandLineApplication application, TextWriter output, IReadOnlyList visibleOptions, int firstColumnWidth) diff --git a/src/Stryker.CLI/Stryker.CLI/StrykerCLI.cs b/src/Stryker.CLI/Stryker.CLI/StrykerCLI.cs index a43f619a47..addd39262f 100644 --- a/src/Stryker.CLI/Stryker.CLI/StrykerCLI.cs +++ b/src/Stryker.CLI/Stryker.CLI/StrykerCLI.cs @@ -9,6 +9,7 @@ using Stryker.CLI.Logging; using Stryker.Core; using Stryker.Core.Options; +using Stryker.Core.Options.Inputs; namespace Stryker.CLI { @@ -45,7 +46,7 @@ public int Run(string[] args) { Name = "Stryker", FullName = "Stryker: Stryker mutator for .Net", - Description = "Stryker mutator for .Net", + Description = "The mutation test framework for .Net", ExtendedHelpText = "Welcome to Stryker for .Net! Run dotnet stryker to kick off a mutation test run", HelpTextGenerator = new GroupedHelpTextGenerator() }; @@ -60,10 +61,29 @@ public int Run(string[] args) { baselineCmd.Description = "Enables the baseline feature"; cmdConfigReader.RegisterCommandLineOptions(baselineCmd, inputs); - + var targetInput = new CliInput() + { + Input = new BaselineTargetInput(), + ArgumentName = "target", + ArgumentShortName = "t", + Description = @"The target for the compare. For example, when runnin on branch feat-2 and wanting to compare to branch ""main"", set this value to ""main""", + Category = InputCategory.Mutation + }; + var targetOption = new CommandOption("-t|--target ", CommandOptionType.SingleValue) { + LongName = "target", + ShortName = "t", + Description = @"The target for the compare. For example, when runnin on branch feat-2 and wanting to compare to branch ""main"", set this value to ""main""", + ShowInHelpText = true + }; + cmdConfigReader.RegisterCliInput(app, targetInput); + cmdConfigReader.AddCliInput(targetInput.Input, "--target", "-t", CommandOptionType.SingleValue, InputCategory.Mutation); + baselineCmd.AddOption(targetOption); baselineCmd.Command("recreate", createCmd => { cmdConfigReader.RegisterCommandLineOptions(createCmd, inputs); + cmdConfigReader.RegisterCliInput(app, targetInput); + cmdConfigReader.AddCliInput(targetInput.Input, "--target", "-t", CommandOptionType.SingleValue, InputCategory.Mutation); + createCmd.AddOption(targetOption); createCmd.OnExecute(() => { diff --git a/src/Stryker.Core/Stryker.Core/Options/Inputs/BaselineTargetInput.cs b/src/Stryker.Core/Stryker.Core/Options/Inputs/BaselineTargetInput.cs new file mode 100644 index 0000000000..9f67c280bb --- /dev/null +++ b/src/Stryker.Core/Stryker.Core/Options/Inputs/BaselineTargetInput.cs @@ -0,0 +1,24 @@ +using Stryker.Core.Exceptions; + +namespace Stryker.Core.Options.Inputs +{ + public class BaselineTargetInput : Input + { + public override string Default => "main"; + protected override string Description => "The target branch/commit to compare with the current codebase when the baseline feature is enabled."; + + public string Validate(bool sinceEnabled) + { + if (sinceEnabled && SuppliedInput is not null) + { + if (string.IsNullOrWhiteSpace(SuppliedInput)) + { + throw new InputException("The baseline target cannot be empty when the since feature is enabled"); + } + + return SuppliedInput; + } + return Default; + } + } +} From ca9b3546c3d2918933a29ba14c1d99dcf11e7a6b Mon Sep 17 00:00:00 2001 From: Dani Hengeveld Date: Fri, 13 Oct 2023 15:12:37 +0200 Subject: [PATCH 10/27] Merge master, fix and add tests, consistency (#2712) * chore(deps): update dependency buildalyzer to v5.0.1 (#2665) * chore(deps): update dependency buildalyzer to v5.0.1 * Update package lock files --------- Co-authored-by: Renovatebot * chore: fix page links for site * fix: Don't fail the test run if restoring test assemblies fails (#2664) * chore(deps): update xunit-dotnet monorepo to v2.5.1 (#2673) * chore(deps): update xunit-dotnet monorepo to v2.5.1 * Update package lock files --------- Co-authored-by: Renovatebot * chore(deps): update dependency yamldotnet to v13.4.0 (#2677) * chore(deps): update dependency yamldotnet to v13.4.0 * Update package lock files --------- Co-authored-by: Renovatebot * chore: F# range math (#2679) * F# range math * Windows x Linux * Up * chore: Passing Stryker options to F# project components (#2680) Co-authored-by: Rouke Broersma * fix: Use solution file when it's available (#2690) * Use solution file when it's available * fix unit test * sonarqube * chore(compilation): Improve Error and Trace Logging (#2688) Add logs Co-authored-by: Rouke Broersma * fix: Remove usings from MutantControl (#2694) chore: remove usings from MutantControl Co-authored-by: Rouke Broersma * chore: Code quality improvements (#2696) * Use string builder in loop * Use find & handle other platform newlines * Use find * Fix duplicate message * Add more range tests * Improve range code * docs: add SAS configuration (#2676) (#2701) docs: add SAS configuration * chore(deps): update dependency launchdarkly.eventsource to v5.1.0 (#2702) * chore(deps): update dependency launchdarkly.eventsource to v5.1.0 * Update package lock files --------- Co-authored-by: Renovatebot * chore(deps): update dependency yamldotnet to v13.5.0 (#2703) * chore(deps): update dependency yamldotnet to v13.5.0 * Update package lock files --------- Co-authored-by: Renovatebot * chore(deps): update dependency yamldotnet to v13.5.1 (#2704) * chore(deps): update dependency yamldotnet to v13.5.1 * Update package lock files --------- Co-authored-by: Renovatebot * chore(deps): update dependency yamldotnet to v13.7.0 (#2705) * chore(deps): update dependency yamldotnet to v13.7.0 * Update package lock files --------- Co-authored-by: Renovatebot * chore(deps): update xunit-dotnet monorepo (#2711) * chore(deps): update xunit-dotnet monorepo * Update package lock files --------- Co-authored-by: Renovatebot * chore: Breaking down FilePattern (#2681) * Simplifying DiffIgnoreChangesInput * Update FilePattern.cs * Up * up * Rename the class * up --------- Co-authored-by: Rouke Broersma * chore: Splitting some C# related extensions in a separate file (#2697) Splitting some C# related extensions in a separate file Co-authored-by: Rouke Broersma * fix: tests for `OpenReportEnabledInput` help text * fix: typo in re(c)reate * add: tests for baseline target input. change: target input default to 'master' to stay consistent with since target input. --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Renovatebot Co-authored-by: Rouke Broersma Co-authored-by: Pent Ploompuu Co-authored-by: Petr Co-authored-by: Rouke Broersma Co-authored-by: Jack Steel Co-authored-by: Cyrille DUPUYDAUBY Co-authored-by: Max S --- .../boolMutateTestApp.Test.fsproj | 4 +- .../Xamarin.Forms.Tests.csproj | 4 +- adding_a_mutator.md | 4 +- docs/configuration.md | 10 +- .../EmptyTestProject/EmptyTestProject.csproj | 4 +- .../EmptyTestProject/packages.lock.json | 44 +- .../ExtraProject.XUnit.csproj | 4 +- .../ExtraProject.XUnit/packages.lock.json | 47 +- .../Library.FSharp.XUnit.fsproj | 4 +- .../Library.FSharp.XUnit/packages.lock.json | 44 +- .../NetCoreTestProject.XUnit.csproj | 4 +- .../packages.lock.json | 44 +- .../ValidationProject/Validation.csproj | 4 +- src/Directory.Packages.props | 10 +- .../Stryker.CLI.UnitTest/packages.lock.json | 128 ++--- .../Stryker.CLI/packages.lock.json | 76 +-- .../DiffProviders/GitDiffProviderTests.cs | 8 +- .../ExclusionPatternTests.cs | 36 ++ .../{Options => }/FilePatternTests.cs | 2 +- .../Helpers/RangeHelperTests.cs | 534 ++++++++++++++++++ .../TextSpanHelperTests.cs} | 10 +- .../TargetFrameworkResolutionTests.cs | 2 +- .../Inputs/BaselineCreateEnabledInputTests.cs | 41 -- .../BaselineRecreateEnabledInputTests.cs | 37 ++ .../Inputs/BaselineTargetInputTests.cs | 52 ++ .../Inputs/OpenReportEnabledInputTests.cs | 5 +- .../Options/Inputs/SinceTargetInputTests.cs | 11 +- .../Options/StrykerOptionsTests.cs | 2 +- .../Stryker.Core.UnitTest/packages.lock.json | 128 ++--- .../Compiling/CsharpCompilingProcess.cs | 25 +- .../Stryker.Core/ExclusionPattern.cs | 49 ++ src/Stryker.Core/Stryker.Core/FilePattern.cs | 39 +- .../Stryker.Core/Helpers/RangeHelper.cs | 198 +++++++ .../Stryker.Core/Helpers/TextSpanHelper.cs | 101 ++++ .../IAnalyzerResultCSharpExtensions.cs | 41 ++ .../Buildalyzer/IAnalyzerResultExtensions.cs | 43 +- .../FsharpProjectComponentsBuilder.cs | 5 +- .../Initialisation/InputFileResolver.cs | 15 +- .../Initialisation/ProjectFileReader.cs | 24 +- .../InjectedHelpers/MutantControl.cs | 26 +- .../Inputs/BaselineCreateEnabledInput.cs | 2 +- .../Options/Inputs/BaselineTargetInput.cs | 2 +- .../Options/Inputs/DiffIgnoreChangesInput.cs | 10 +- .../Stryker.Core/Options/StrykerInputs.cs | 4 +- .../Stryker.Core/Options/StrykerOptions.cs | 2 +- .../ProjectComponentsExtensions.cs | 94 +-- .../TestProjects/TestProjectsInfo.cs | 9 +- .../Stryker.Core/packages.lock.json | 12 +- .../packages.lock.json | 44 +- 49 files changed, 1471 insertions(+), 577 deletions(-) create mode 100644 src/Stryker.Core/Stryker.Core.UnitTest/ExclusionPatternTests.cs rename src/Stryker.Core/Stryker.Core.UnitTest/{Options => }/FilePatternTests.cs (98%) create mode 100644 src/Stryker.Core/Stryker.Core.UnitTest/Helpers/RangeHelperTests.cs rename src/Stryker.Core/Stryker.Core.UnitTest/{ProjectComponents/ProjectComponentExtensionsTests.cs => Helpers/TextSpanHelperTests.cs} (94%) delete mode 100644 src/Stryker.Core/Stryker.Core.UnitTest/Options/Inputs/BaselineCreateEnabledInputTests.cs create mode 100644 src/Stryker.Core/Stryker.Core.UnitTest/Options/Inputs/BaselineRecreateEnabledInputTests.cs create mode 100644 src/Stryker.Core/Stryker.Core.UnitTest/Options/Inputs/BaselineTargetInputTests.cs create mode 100644 src/Stryker.Core/Stryker.Core/ExclusionPattern.cs create mode 100644 src/Stryker.Core/Stryker.Core/Helpers/RangeHelper.cs create mode 100644 src/Stryker.Core/Stryker.Core/Helpers/TextSpanHelper.cs create mode 100644 src/Stryker.Core/Stryker.Core/Initialisation/Buildalyzer/IAnalyzerResultCSharpExtensions.cs diff --git a/ExampleProjects/FsharpMutateTestApp/boolMutateTestApp.Test/boolMutateTestApp.Test.fsproj b/ExampleProjects/FsharpMutateTestApp/boolMutateTestApp.Test/boolMutateTestApp.Test.fsproj index b0f9c6a74f..8bd05448a8 100644 --- a/ExampleProjects/FsharpMutateTestApp/boolMutateTestApp.Test/boolMutateTestApp.Test.fsproj +++ b/ExampleProjects/FsharpMutateTestApp/boolMutateTestApp.Test/boolMutateTestApp.Test.fsproj @@ -14,8 +14,8 @@ - - + + diff --git a/ExampleProjects/Xamarin.Forms/Xamarin.Forms.Tests/Xamarin.Forms.Tests.csproj b/ExampleProjects/Xamarin.Forms/Xamarin.Forms.Tests/Xamarin.Forms.Tests.csproj index 2dee394d80..48752d0d25 100644 --- a/ExampleProjects/Xamarin.Forms/Xamarin.Forms.Tests/Xamarin.Forms.Tests.csproj +++ b/ExampleProjects/Xamarin.Forms/Xamarin.Forms.Tests/Xamarin.Forms.Tests.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/adding_a_mutator.md b/adding_a_mutator.md index 7aaa6c19ea..0ad3f11c52 100644 --- a/adding_a_mutator.md +++ b/adding_a_mutator.md @@ -73,8 +73,8 @@ You need to: - It is ok to mutate new constructs (such as arrow expression) and leave the old constructs as is. The reverse is not true. - Your mutator must return an empty list (or `yield break`) if it cannot generate any mutation. - Mutator must not throw. -- Make sure to update the [mutations documentation](docs/mutations.md). +- Make sure to update the [mutations documentation](./docs/mutations.md). -[Back to main contributing document](CONTRIBUTING.md). +[Back to main contributing document](./CONTRIBUTING.md). [1]: https://docs.microsoft.com/en-us/dotnet/csharp/roslyn-sdk/get-started/syntax-analysis "Get started with syntax analysis" diff --git a/docs/configuration.md b/docs/configuration.md index dee50213d2..9dac80bf9e 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -573,7 +573,15 @@ Command line: `--azure-fileshare-sas "se=2022-08-25T14%3A27Z&sp=rwdl&spr=https&s Config file: `N/A` When using the azure file storage [provider](#baselineprovider-string) you must pass credentials for the fileshare to Stryker. -For authentication with the azure fileshare we support Shared Access Signatures. For more information on how to configure a SAS check the [Azure documentation](https://docs.microsoft.com/en-us/azure/storage/common/storage-sas-overview). +For authentication with the azure fileshare we support Shared Access Signatures (SAS). + +The SAS should be configured with the following properties: + +Allowed services: `File` +Allowed resource types: `Container`, `Object` +Allowed permissions: `Read`, `Write`, `Create` + +For more information on how to configure a SAS check the [Azure documentation](https://docs.microsoft.com/en-us/azure/storage/common/storage-sas-overview). ### `baseline recreate` <`flag`> diff --git a/integrationtest/TargetProjects/EmptyTestProject/EmptyTestProject.csproj b/integrationtest/TargetProjects/EmptyTestProject/EmptyTestProject.csproj index 788065c443..deadc68326 100644 --- a/integrationtest/TargetProjects/EmptyTestProject/EmptyTestProject.csproj +++ b/integrationtest/TargetProjects/EmptyTestProject/EmptyTestProject.csproj @@ -11,8 +11,8 @@ - - + + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/integrationtest/TargetProjects/EmptyTestProject/packages.lock.json b/integrationtest/TargetProjects/EmptyTestProject/packages.lock.json index b6daf051d1..80fda52a02 100644 --- a/integrationtest/TargetProjects/EmptyTestProject/packages.lock.json +++ b/integrationtest/TargetProjects/EmptyTestProject/packages.lock.json @@ -20,20 +20,20 @@ }, "xunit": { "type": "Direct", - "requested": "[2.5.0, )", - "resolved": "2.5.0", - "contentHash": "f2V5wuAdoaq0mRTt9UBmPbVex9HcwFYn+y7WaKUz5Xpakcrv7lhtQWBJUWNY4N3Z+o+atDBLyAALM1QWx04C6Q==", + "requested": "[2.5.2, )", + "resolved": "2.5.2", + "contentHash": "cClLEtMhn9H85jdZILz564FkBHOUP1/KmpColguzWpzXDY8cFRRZ2gW58ahdWBznz8UzRabAUqY+5vZKia+AmQ==", "dependencies": { - "xunit.analyzers": "1.2.0", - "xunit.assert": "2.5.0", - "xunit.core": "[2.5.0]" + "xunit.analyzers": "1.4.0", + "xunit.assert": "2.5.2", + "xunit.core": "[2.5.2]" } }, "xunit.runner.visualstudio": { "type": "Direct", - "requested": "[2.5.0, )", - "resolved": "2.5.0", - "contentHash": "+Gp9vuC2431yPyKB15YrOTxCuEAErBQUTIs6CquumX1F073UaPHGW0VE/XVJLMh9W4sXdz3TBkcHdFWZrRn2Hw==" + "requested": "[2.5.3, )", + "resolved": "2.5.3", + "contentHash": "HFFL6O+QLEOfs555SqHii48ovVa4CqGYanY+B32BjLpPptdE+wEJmCFNXlLHdEOD5LYeayb9EroaUpydGpcybg==" }, "Microsoft.CodeCoverage": { "type": "Transitive", @@ -978,30 +978,30 @@ }, "xunit.analyzers": { "type": "Transitive", - "resolved": "1.2.0", - "contentHash": "d3dehV/DASLRlR8stWQmbPPjfYC2tct50Evav+OlsJMkfFqkhYvzO1k0s81lk0px8O0knZU/FqC8SqbXOtn+hw==" + "resolved": "1.4.0", + "contentHash": "7ljnTJfFjz5zK+Jf0h2dd2QOSO6UmFizXsojv/x4QX7TU5vEgtKZPk9RvpkiuUqg2bddtNZufBoKQalsi7djfA==" }, "xunit.assert": { "type": "Transitive", - "resolved": "2.5.0", - "contentHash": "wN84pKX5jzfpgJ0bB6arrCA/oelBeYLCpnQ9Wj5xGEVPydKzVSDY5tEatFLHE/rO0+0RC+I4H5igGE118jRh1w==", + "resolved": "2.5.2", + "contentHash": "dZNLJWG5HfMAvWBub7eDZwOkP4xuXJj1TSC2AP3bjzIFVGb8rD8xWTvgXlRBXtgPgH+I4Y5hz2MBQrGqUxjDDg==", "dependencies": { "NETStandard.Library": "1.6.1" } }, "xunit.core": { "type": "Transitive", - "resolved": "2.5.0", - "contentHash": "dnV0Mn2s1C0y2m33AylQyMkEyhBQsL4R0302kwSGiEGuY3JwzEmhTa9pnghyMRPliYSs4fXfkEAP+5bKXryGFg==", + "resolved": "2.5.2", + "contentHash": "q1PBUBD1Zxbu5WvRfdpzjUHDzs9vr65gNptEGTQmXISXMXeMG9YPX29Z7oZB0wXSccUCtwQ9uQBd5bkaCMS7hQ==", "dependencies": { - "xunit.extensibility.core": "[2.5.0]", - "xunit.extensibility.execution": "[2.5.0]" + "xunit.extensibility.core": "[2.5.2]", + "xunit.extensibility.execution": "[2.5.2]" } }, "xunit.extensibility.core": { "type": "Transitive", - "resolved": "2.5.0", - "contentHash": "xRm6NIV3i7I+LkjsAJ91Xz2fxJm/oMEi2CYq1G5HlGTgcK1Zo2wNbLO6nKX1VG5FZzXibSdoLwr/MofVvh3mFA==", + "resolved": "2.5.2", + "contentHash": "peV3Y8Pt3wNoIdHeeGClI4qKUeiEX0LuihAYqbAU0g99sidiPItMsUAURjkAoo3JqX5Lrsg+jiVukXp4Tijmfw==", "dependencies": { "NETStandard.Library": "1.6.1", "xunit.abstractions": "2.0.3" @@ -1009,11 +1009,11 @@ }, "xunit.extensibility.execution": { "type": "Transitive", - "resolved": "2.5.0", - "contentHash": "7+v2Bvp+1ew1iMGQVb1glICi8jcNdHbRUX6Ru0dmJBViGdjiS7kyqcX2VxleQhFbKNi+WF0an7/TeTXD283RlQ==", + "resolved": "2.5.2", + "contentHash": "w3Q45Rvva0z1KPtXN5j2DjY9VgBCdWT0mkkr+dZKVyzBtIxnIywzvbEFLJix/dzHdE3XYDXbzh5GfLJHGCDTUg==", "dependencies": { "NETStandard.Library": "1.6.1", - "xunit.extensibility.core": "[2.5.0]" + "xunit.extensibility.core": "[2.5.2]" } }, "library": { diff --git a/integrationtest/TargetProjects/ExtraProject.XUnit/ExtraProject.XUnit.csproj b/integrationtest/TargetProjects/ExtraProject.XUnit/ExtraProject.XUnit.csproj index 5d83b110cc..5ae36758eb 100644 --- a/integrationtest/TargetProjects/ExtraProject.XUnit/ExtraProject.XUnit.csproj +++ b/integrationtest/TargetProjects/ExtraProject.XUnit/ExtraProject.XUnit.csproj @@ -8,8 +8,8 @@ - - + + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/integrationtest/TargetProjects/ExtraProject.XUnit/packages.lock.json b/integrationtest/TargetProjects/ExtraProject.XUnit/packages.lock.json index ea8d806c4b..a71587c674 100644 --- a/integrationtest/TargetProjects/ExtraProject.XUnit/packages.lock.json +++ b/integrationtest/TargetProjects/ExtraProject.XUnit/packages.lock.json @@ -20,20 +20,23 @@ }, "xunit": { "type": "Direct", - "requested": "[2.5.0, )", - "resolved": "2.5.0", - "contentHash": "f2V5wuAdoaq0mRTt9UBmPbVex9HcwFYn+y7WaKUz5Xpakcrv7lhtQWBJUWNY4N3Z+o+atDBLyAALM1QWx04C6Q==", + "requested": "[2.5.2, )", + "resolved": "2.5.2", + "contentHash": "cClLEtMhn9H85jdZILz564FkBHOUP1/KmpColguzWpzXDY8cFRRZ2gW58ahdWBznz8UzRabAUqY+5vZKia+AmQ==", "dependencies": { - "xunit.analyzers": "1.2.0", - "xunit.assert": "2.5.0", - "xunit.core": "[2.5.0]" + "xunit.analyzers": "1.4.0", + "xunit.assert": "2.5.2", + "xunit.core": "[2.5.2]" } }, "xunit.runner.visualstudio": { "type": "Direct", - "requested": "[2.5.0, )", - "resolved": "2.5.0", - "contentHash": "+Gp9vuC2431yPyKB15YrOTxCuEAErBQUTIs6CquumX1F073UaPHGW0VE/XVJLMh9W4sXdz3TBkcHdFWZrRn2Hw==" + "requested": "[2.5.3, )", + "resolved": "2.5.3", + "contentHash": "HFFL6O+QLEOfs555SqHii48ovVa4CqGYanY+B32BjLpPptdE+wEJmCFNXlLHdEOD5LYeayb9EroaUpydGpcybg==", + "dependencies": { + "Microsoft.TestPlatform.ObjectModel": "17.7.2" + } }, "Microsoft.CodeCoverage": { "type": "Transitive", @@ -978,30 +981,30 @@ }, "xunit.analyzers": { "type": "Transitive", - "resolved": "1.2.0", - "contentHash": "d3dehV/DASLRlR8stWQmbPPjfYC2tct50Evav+OlsJMkfFqkhYvzO1k0s81lk0px8O0knZU/FqC8SqbXOtn+hw==" + "resolved": "1.4.0", + "contentHash": "7ljnTJfFjz5zK+Jf0h2dd2QOSO6UmFizXsojv/x4QX7TU5vEgtKZPk9RvpkiuUqg2bddtNZufBoKQalsi7djfA==" }, "xunit.assert": { "type": "Transitive", - "resolved": "2.5.0", - "contentHash": "wN84pKX5jzfpgJ0bB6arrCA/oelBeYLCpnQ9Wj5xGEVPydKzVSDY5tEatFLHE/rO0+0RC+I4H5igGE118jRh1w==", + "resolved": "2.5.2", + "contentHash": "dZNLJWG5HfMAvWBub7eDZwOkP4xuXJj1TSC2AP3bjzIFVGb8rD8xWTvgXlRBXtgPgH+I4Y5hz2MBQrGqUxjDDg==", "dependencies": { "NETStandard.Library": "1.6.1" } }, "xunit.core": { "type": "Transitive", - "resolved": "2.5.0", - "contentHash": "dnV0Mn2s1C0y2m33AylQyMkEyhBQsL4R0302kwSGiEGuY3JwzEmhTa9pnghyMRPliYSs4fXfkEAP+5bKXryGFg==", + "resolved": "2.5.2", + "contentHash": "q1PBUBD1Zxbu5WvRfdpzjUHDzs9vr65gNptEGTQmXISXMXeMG9YPX29Z7oZB0wXSccUCtwQ9uQBd5bkaCMS7hQ==", "dependencies": { - "xunit.extensibility.core": "[2.5.0]", - "xunit.extensibility.execution": "[2.5.0]" + "xunit.extensibility.core": "[2.5.2]", + "xunit.extensibility.execution": "[2.5.2]" } }, "xunit.extensibility.core": { "type": "Transitive", - "resolved": "2.5.0", - "contentHash": "xRm6NIV3i7I+LkjsAJ91Xz2fxJm/oMEi2CYq1G5HlGTgcK1Zo2wNbLO6nKX1VG5FZzXibSdoLwr/MofVvh3mFA==", + "resolved": "2.5.2", + "contentHash": "peV3Y8Pt3wNoIdHeeGClI4qKUeiEX0LuihAYqbAU0g99sidiPItMsUAURjkAoo3JqX5Lrsg+jiVukXp4Tijmfw==", "dependencies": { "NETStandard.Library": "1.6.1", "xunit.abstractions": "2.0.3" @@ -1009,11 +1012,11 @@ }, "xunit.extensibility.execution": { "type": "Transitive", - "resolved": "2.5.0", - "contentHash": "7+v2Bvp+1ew1iMGQVb1glICi8jcNdHbRUX6Ru0dmJBViGdjiS7kyqcX2VxleQhFbKNi+WF0an7/TeTXD283RlQ==", + "resolved": "2.5.2", + "contentHash": "w3Q45Rvva0z1KPtXN5j2DjY9VgBCdWT0mkkr+dZKVyzBtIxnIywzvbEFLJix/dzHdE3XYDXbzh5GfLJHGCDTUg==", "dependencies": { "NETStandard.Library": "1.6.1", - "xunit.extensibility.core": "[2.5.0]" + "xunit.extensibility.core": "[2.5.2]" } }, "extraproject": { diff --git a/integrationtest/TargetProjects/Library.FSharp.XUnit/Library.FSharp.XUnit.fsproj b/integrationtest/TargetProjects/Library.FSharp.XUnit/Library.FSharp.XUnit.fsproj index 276a5df8f6..f193136a4d 100644 --- a/integrationtest/TargetProjects/Library.FSharp.XUnit/Library.FSharp.XUnit.fsproj +++ b/integrationtest/TargetProjects/Library.FSharp.XUnit/Library.FSharp.XUnit.fsproj @@ -15,8 +15,8 @@ - - + + diff --git a/integrationtest/TargetProjects/Library.FSharp.XUnit/packages.lock.json b/integrationtest/TargetProjects/Library.FSharp.XUnit/packages.lock.json index cbc69da24f..087a153e05 100644 --- a/integrationtest/TargetProjects/Library.FSharp.XUnit/packages.lock.json +++ b/integrationtest/TargetProjects/Library.FSharp.XUnit/packages.lock.json @@ -20,20 +20,20 @@ }, "xunit": { "type": "Direct", - "requested": "[2.5.0, )", - "resolved": "2.5.0", - "contentHash": "f2V5wuAdoaq0mRTt9UBmPbVex9HcwFYn+y7WaKUz5Xpakcrv7lhtQWBJUWNY4N3Z+o+atDBLyAALM1QWx04C6Q==", + "requested": "[2.5.2, )", + "resolved": "2.5.2", + "contentHash": "cClLEtMhn9H85jdZILz564FkBHOUP1/KmpColguzWpzXDY8cFRRZ2gW58ahdWBznz8UzRabAUqY+5vZKia+AmQ==", "dependencies": { - "xunit.analyzers": "1.2.0", - "xunit.assert": "2.5.0", - "xunit.core": "[2.5.0]" + "xunit.analyzers": "1.4.0", + "xunit.assert": "2.5.2", + "xunit.core": "[2.5.2]" } }, "xunit.runner.visualstudio": { "type": "Direct", - "requested": "[2.5.0, )", - "resolved": "2.5.0", - "contentHash": "+Gp9vuC2431yPyKB15YrOTxCuEAErBQUTIs6CquumX1F073UaPHGW0VE/XVJLMh9W4sXdz3TBkcHdFWZrRn2Hw==" + "requested": "[2.5.3, )", + "resolved": "2.5.3", + "contentHash": "HFFL6O+QLEOfs555SqHii48ovVa4CqGYanY+B32BjLpPptdE+wEJmCFNXlLHdEOD5LYeayb9EroaUpydGpcybg==" }, "Microsoft.CodeCoverage": { "type": "Transitive", @@ -978,30 +978,30 @@ }, "xunit.analyzers": { "type": "Transitive", - "resolved": "1.2.0", - "contentHash": "d3dehV/DASLRlR8stWQmbPPjfYC2tct50Evav+OlsJMkfFqkhYvzO1k0s81lk0px8O0knZU/FqC8SqbXOtn+hw==" + "resolved": "1.4.0", + "contentHash": "7ljnTJfFjz5zK+Jf0h2dd2QOSO6UmFizXsojv/x4QX7TU5vEgtKZPk9RvpkiuUqg2bddtNZufBoKQalsi7djfA==" }, "xunit.assert": { "type": "Transitive", - "resolved": "2.5.0", - "contentHash": "wN84pKX5jzfpgJ0bB6arrCA/oelBeYLCpnQ9Wj5xGEVPydKzVSDY5tEatFLHE/rO0+0RC+I4H5igGE118jRh1w==", + "resolved": "2.5.2", + "contentHash": "dZNLJWG5HfMAvWBub7eDZwOkP4xuXJj1TSC2AP3bjzIFVGb8rD8xWTvgXlRBXtgPgH+I4Y5hz2MBQrGqUxjDDg==", "dependencies": { "NETStandard.Library": "1.6.1" } }, "xunit.core": { "type": "Transitive", - "resolved": "2.5.0", - "contentHash": "dnV0Mn2s1C0y2m33AylQyMkEyhBQsL4R0302kwSGiEGuY3JwzEmhTa9pnghyMRPliYSs4fXfkEAP+5bKXryGFg==", + "resolved": "2.5.2", + "contentHash": "q1PBUBD1Zxbu5WvRfdpzjUHDzs9vr65gNptEGTQmXISXMXeMG9YPX29Z7oZB0wXSccUCtwQ9uQBd5bkaCMS7hQ==", "dependencies": { - "xunit.extensibility.core": "[2.5.0]", - "xunit.extensibility.execution": "[2.5.0]" + "xunit.extensibility.core": "[2.5.2]", + "xunit.extensibility.execution": "[2.5.2]" } }, "xunit.extensibility.core": { "type": "Transitive", - "resolved": "2.5.0", - "contentHash": "xRm6NIV3i7I+LkjsAJ91Xz2fxJm/oMEi2CYq1G5HlGTgcK1Zo2wNbLO6nKX1VG5FZzXibSdoLwr/MofVvh3mFA==", + "resolved": "2.5.2", + "contentHash": "peV3Y8Pt3wNoIdHeeGClI4qKUeiEX0LuihAYqbAU0g99sidiPItMsUAURjkAoo3JqX5Lrsg+jiVukXp4Tijmfw==", "dependencies": { "NETStandard.Library": "1.6.1", "xunit.abstractions": "2.0.3" @@ -1009,11 +1009,11 @@ }, "xunit.extensibility.execution": { "type": "Transitive", - "resolved": "2.5.0", - "contentHash": "7+v2Bvp+1ew1iMGQVb1glICi8jcNdHbRUX6Ru0dmJBViGdjiS7kyqcX2VxleQhFbKNi+WF0an7/TeTXD283RlQ==", + "resolved": "2.5.2", + "contentHash": "w3Q45Rvva0z1KPtXN5j2DjY9VgBCdWT0mkkr+dZKVyzBtIxnIywzvbEFLJix/dzHdE3XYDXbzh5GfLJHGCDTUg==", "dependencies": { "NETStandard.Library": "1.6.1", - "xunit.extensibility.core": "[2.5.0]" + "xunit.extensibility.core": "[2.5.2]" } }, "library.fsharp": { diff --git a/integrationtest/TargetProjects/NetCoreTestProject.XUnit/NetCoreTestProject.XUnit.csproj b/integrationtest/TargetProjects/NetCoreTestProject.XUnit/NetCoreTestProject.XUnit.csproj index 80f6cb0020..7d437422b4 100644 --- a/integrationtest/TargetProjects/NetCoreTestProject.XUnit/NetCoreTestProject.XUnit.csproj +++ b/integrationtest/TargetProjects/NetCoreTestProject.XUnit/NetCoreTestProject.XUnit.csproj @@ -10,8 +10,8 @@ - - + + diff --git a/integrationtest/TargetProjects/NetCoreTestProject.XUnit/packages.lock.json b/integrationtest/TargetProjects/NetCoreTestProject.XUnit/packages.lock.json index c290fcf286..9efc4d67d1 100644 --- a/integrationtest/TargetProjects/NetCoreTestProject.XUnit/packages.lock.json +++ b/integrationtest/TargetProjects/NetCoreTestProject.XUnit/packages.lock.json @@ -14,20 +14,20 @@ }, "xunit": { "type": "Direct", - "requested": "[2.5.0, )", - "resolved": "2.5.0", - "contentHash": "f2V5wuAdoaq0mRTt9UBmPbVex9HcwFYn+y7WaKUz5Xpakcrv7lhtQWBJUWNY4N3Z+o+atDBLyAALM1QWx04C6Q==", + "requested": "[2.5.2, )", + "resolved": "2.5.2", + "contentHash": "cClLEtMhn9H85jdZILz564FkBHOUP1/KmpColguzWpzXDY8cFRRZ2gW58ahdWBznz8UzRabAUqY+5vZKia+AmQ==", "dependencies": { - "xunit.analyzers": "1.2.0", - "xunit.assert": "2.5.0", - "xunit.core": "[2.5.0]" + "xunit.analyzers": "1.4.0", + "xunit.assert": "2.5.2", + "xunit.core": "[2.5.2]" } }, "xunit.runner.visualstudio": { "type": "Direct", - "requested": "[2.5.0, )", - "resolved": "2.5.0", - "contentHash": "+Gp9vuC2431yPyKB15YrOTxCuEAErBQUTIs6CquumX1F073UaPHGW0VE/XVJLMh9W4sXdz3TBkcHdFWZrRn2Hw==" + "requested": "[2.5.3, )", + "resolved": "2.5.3", + "contentHash": "HFFL6O+QLEOfs555SqHii48ovVa4CqGYanY+B32BjLpPptdE+wEJmCFNXlLHdEOD5LYeayb9EroaUpydGpcybg==" }, "Microsoft.CodeCoverage": { "type": "Transitive", @@ -972,30 +972,30 @@ }, "xunit.analyzers": { "type": "Transitive", - "resolved": "1.2.0", - "contentHash": "d3dehV/DASLRlR8stWQmbPPjfYC2tct50Evav+OlsJMkfFqkhYvzO1k0s81lk0px8O0knZU/FqC8SqbXOtn+hw==" + "resolved": "1.4.0", + "contentHash": "7ljnTJfFjz5zK+Jf0h2dd2QOSO6UmFizXsojv/x4QX7TU5vEgtKZPk9RvpkiuUqg2bddtNZufBoKQalsi7djfA==" }, "xunit.assert": { "type": "Transitive", - "resolved": "2.5.0", - "contentHash": "wN84pKX5jzfpgJ0bB6arrCA/oelBeYLCpnQ9Wj5xGEVPydKzVSDY5tEatFLHE/rO0+0RC+I4H5igGE118jRh1w==", + "resolved": "2.5.2", + "contentHash": "dZNLJWG5HfMAvWBub7eDZwOkP4xuXJj1TSC2AP3bjzIFVGb8rD8xWTvgXlRBXtgPgH+I4Y5hz2MBQrGqUxjDDg==", "dependencies": { "NETStandard.Library": "1.6.1" } }, "xunit.core": { "type": "Transitive", - "resolved": "2.5.0", - "contentHash": "dnV0Mn2s1C0y2m33AylQyMkEyhBQsL4R0302kwSGiEGuY3JwzEmhTa9pnghyMRPliYSs4fXfkEAP+5bKXryGFg==", + "resolved": "2.5.2", + "contentHash": "q1PBUBD1Zxbu5WvRfdpzjUHDzs9vr65gNptEGTQmXISXMXeMG9YPX29Z7oZB0wXSccUCtwQ9uQBd5bkaCMS7hQ==", "dependencies": { - "xunit.extensibility.core": "[2.5.0]", - "xunit.extensibility.execution": "[2.5.0]" + "xunit.extensibility.core": "[2.5.2]", + "xunit.extensibility.execution": "[2.5.2]" } }, "xunit.extensibility.core": { "type": "Transitive", - "resolved": "2.5.0", - "contentHash": "xRm6NIV3i7I+LkjsAJ91Xz2fxJm/oMEi2CYq1G5HlGTgcK1Zo2wNbLO6nKX1VG5FZzXibSdoLwr/MofVvh3mFA==", + "resolved": "2.5.2", + "contentHash": "peV3Y8Pt3wNoIdHeeGClI4qKUeiEX0LuihAYqbAU0g99sidiPItMsUAURjkAoo3JqX5Lrsg+jiVukXp4Tijmfw==", "dependencies": { "NETStandard.Library": "1.6.1", "xunit.abstractions": "2.0.3" @@ -1003,11 +1003,11 @@ }, "xunit.extensibility.execution": { "type": "Transitive", - "resolved": "2.5.0", - "contentHash": "7+v2Bvp+1ew1iMGQVb1glICi8jcNdHbRUX6Ru0dmJBViGdjiS7kyqcX2VxleQhFbKNi+WF0an7/TeTXD283RlQ==", + "resolved": "2.5.2", + "contentHash": "w3Q45Rvva0z1KPtXN5j2DjY9VgBCdWT0mkkr+dZKVyzBtIxnIywzvbEFLJix/dzHdE3XYDXbzh5GfLJHGCDTUg==", "dependencies": { "NETStandard.Library": "1.6.1", - "xunit.extensibility.core": "[2.5.0]" + "xunit.extensibility.core": "[2.5.2]" } }, "library": { diff --git a/integrationtest/ValidationProject/Validation.csproj b/integrationtest/ValidationProject/Validation.csproj index b871c71362..c55d100b2f 100644 --- a/integrationtest/ValidationProject/Validation.csproj +++ b/integrationtest/ValidationProject/Validation.csproj @@ -9,8 +9,8 @@ - - + + diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 4ed946601d..d9ab944eec 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -1,16 +1,16 @@ - + - + - + @@ -38,8 +38,8 @@ - - + + diff --git a/src/Stryker.CLI/Stryker.CLI.UnitTest/packages.lock.json b/src/Stryker.CLI/Stryker.CLI.UnitTest/packages.lock.json index 194e30d163..d2f8dc7de4 100644 --- a/src/Stryker.CLI/Stryker.CLI.UnitTest/packages.lock.json +++ b/src/Stryker.CLI/Stryker.CLI.UnitTest/packages.lock.json @@ -77,25 +77,25 @@ }, "xunit": { "type": "Direct", - "requested": "[2.5.0, )", - "resolved": "2.5.0", - "contentHash": "f2V5wuAdoaq0mRTt9UBmPbVex9HcwFYn+y7WaKUz5Xpakcrv7lhtQWBJUWNY4N3Z+o+atDBLyAALM1QWx04C6Q==", + "requested": "[2.5.2, )", + "resolved": "2.5.2", + "contentHash": "cClLEtMhn9H85jdZILz564FkBHOUP1/KmpColguzWpzXDY8cFRRZ2gW58ahdWBznz8UzRabAUqY+5vZKia+AmQ==", "dependencies": { - "xunit.analyzers": "1.2.0", - "xunit.assert": "2.5.0", - "xunit.core": "[2.5.0]" + "xunit.analyzers": "1.4.0", + "xunit.assert": "2.5.2", + "xunit.core": "[2.5.2]" } }, "xunit.runner.visualstudio": { "type": "Direct", - "requested": "[2.5.0, )", - "resolved": "2.5.0", - "contentHash": "+Gp9vuC2431yPyKB15YrOTxCuEAErBQUTIs6CquumX1F073UaPHGW0VE/XVJLMh9W4sXdz3TBkcHdFWZrRn2Hw==" + "requested": "[2.5.3, )", + "resolved": "2.5.3", + "contentHash": "HFFL6O+QLEOfs555SqHii48ovVa4CqGYanY+B32BjLpPptdE+wEJmCFNXlLHdEOD5LYeayb9EroaUpydGpcybg==" }, "Buildalyzer.Logger": { "type": "Transitive", - "resolved": "5.0.0", - "contentHash": "T+bvSIWns87XNUnE9doORmjHOuH3arOTChGHA1IQlUBmKHs/WQt/0MWYZuool3egVVn/552+6c2j0eoKxPSqbw==" + "resolved": "5.0.1", + "contentHash": "7j7SzfYH69xuNFaGHbf6kRcvPUmeTUOV99+63lM0BPn2L4ThlqU7OM0aliVvlNOp5btr4nuU6kQdet5U3G7kyg==" }, "Castle.Core": { "type": "Transitive", @@ -1573,30 +1573,30 @@ }, "xunit.analyzers": { "type": "Transitive", - "resolved": "1.2.0", - "contentHash": "d3dehV/DASLRlR8stWQmbPPjfYC2tct50Evav+OlsJMkfFqkhYvzO1k0s81lk0px8O0knZU/FqC8SqbXOtn+hw==" + "resolved": "1.4.0", + "contentHash": "7ljnTJfFjz5zK+Jf0h2dd2QOSO6UmFizXsojv/x4QX7TU5vEgtKZPk9RvpkiuUqg2bddtNZufBoKQalsi7djfA==" }, "xunit.assert": { "type": "Transitive", - "resolved": "2.5.0", - "contentHash": "wN84pKX5jzfpgJ0bB6arrCA/oelBeYLCpnQ9Wj5xGEVPydKzVSDY5tEatFLHE/rO0+0RC+I4H5igGE118jRh1w==", + "resolved": "2.5.2", + "contentHash": "dZNLJWG5HfMAvWBub7eDZwOkP4xuXJj1TSC2AP3bjzIFVGb8rD8xWTvgXlRBXtgPgH+I4Y5hz2MBQrGqUxjDDg==", "dependencies": { "NETStandard.Library": "1.6.1" } }, "xunit.core": { "type": "Transitive", - "resolved": "2.5.0", - "contentHash": "dnV0Mn2s1C0y2m33AylQyMkEyhBQsL4R0302kwSGiEGuY3JwzEmhTa9pnghyMRPliYSs4fXfkEAP+5bKXryGFg==", + "resolved": "2.5.2", + "contentHash": "q1PBUBD1Zxbu5WvRfdpzjUHDzs9vr65gNptEGTQmXISXMXeMG9YPX29Z7oZB0wXSccUCtwQ9uQBd5bkaCMS7hQ==", "dependencies": { - "xunit.extensibility.core": "[2.5.0]", - "xunit.extensibility.execution": "[2.5.0]" + "xunit.extensibility.core": "[2.5.2]", + "xunit.extensibility.execution": "[2.5.2]" } }, "xunit.extensibility.core": { "type": "Transitive", - "resolved": "2.5.0", - "contentHash": "xRm6NIV3i7I+LkjsAJ91Xz2fxJm/oMEi2CYq1G5HlGTgcK1Zo2wNbLO6nKX1VG5FZzXibSdoLwr/MofVvh3mFA==", + "resolved": "2.5.2", + "contentHash": "peV3Y8Pt3wNoIdHeeGClI4qKUeiEX0LuihAYqbAU0g99sidiPItMsUAURjkAoo3JqX5Lrsg+jiVukXp4Tijmfw==", "dependencies": { "NETStandard.Library": "1.6.1", "xunit.abstractions": "2.0.3" @@ -1604,72 +1604,72 @@ }, "xunit.extensibility.execution": { "type": "Transitive", - "resolved": "2.5.0", - "contentHash": "7+v2Bvp+1ew1iMGQVb1glICi8jcNdHbRUX6Ru0dmJBViGdjiS7kyqcX2VxleQhFbKNi+WF0an7/TeTXD283RlQ==", + "resolved": "2.5.2", + "contentHash": "w3Q45Rvva0z1KPtXN5j2DjY9VgBCdWT0mkkr+dZKVyzBtIxnIywzvbEFLJix/dzHdE3XYDXbzh5GfLJHGCDTUg==", "dependencies": { "NETStandard.Library": "1.6.1", - "xunit.extensibility.core": "[2.5.0]" + "xunit.extensibility.core": "[2.5.2]" } }, "dotnet-stryker": { "type": "Project", "dependencies": { - "McMaster.Extensions.CommandLineUtils": "4.1.0", - "NuGet.Protocol": "6.7.0", - "YamlDotNet": "13.3.1", - "stryker": "3.10.0" + "McMaster.Extensions.CommandLineUtils": "[4.1.0, )", + "NuGet.Protocol": "[6.7.0, )", + "YamlDotNet": "[13.7.0, )", + "stryker": "[3.10.0, )" } }, "stryker": { "type": "Project", "dependencies": { - "Buildalyzer": "5.0.0", - "DotNet.Glob": "3.1.3", - "FSharp.Compiler.Service": "41.0.7", - "Grynwald.MarkdownGenerator": "3.0.106", - "LibGit2Sharp": "0.27.2", - "Microsoft.CodeAnalysis.CSharp": "4.7.0", - "Microsoft.Extensions.Logging": "7.0.0", - "Microsoft.TestPlatform": "17.7.2", - "Microsoft.TestPlatform.ObjectModel": "17.7.2", - "Microsoft.TestPlatform.Portable": "17.7.2", - "Microsoft.TestPlatform.TranslationLayer": "17.7.2", - "Microsoft.Web.LibraryManager.Build": "2.1.175", - "Mono.Cecil": "0.11.5", - "NuGet.Frameworks": "6.7.0", - "ResXResourceReader.NetStandard": "1.1.0", - "Serilog": "3.0.1", - "Serilog.Extensions.Logging": "7.0.0", - "Serilog.Extensions.Logging.File": "3.0.0", - "Serilog.Sinks.Console": "4.1.0", - "ShellProgressBar": "5.2.0", - "Spectre.Console": "0.47.0", - "Spectre.Console.Analyzer": "0.47.0", - "Stryker.DataCollector": "1.0.0", - "Stryker.RegexMutators": "1.0.0", - "TestableIO.System.IO.Abstractions.Wrappers": "19.2.69" + "Buildalyzer": "[5.0.1, )", + "DotNet.Glob": "[3.1.3, )", + "FSharp.Compiler.Service": "[41.0.7, )", + "Grynwald.MarkdownGenerator": "[3.0.106, )", + "LibGit2Sharp": "[0.27.2, )", + "Microsoft.CodeAnalysis.CSharp": "[4.7.0, )", + "Microsoft.Extensions.Logging": "[7.0.0, )", + "Microsoft.TestPlatform": "[17.7.2, )", + "Microsoft.TestPlatform.ObjectModel": "[17.7.2, )", + "Microsoft.TestPlatform.Portable": "[17.7.2, )", + "Microsoft.TestPlatform.TranslationLayer": "[17.7.2, )", + "Microsoft.Web.LibraryManager.Build": "[2.1.175, )", + "Mono.Cecil": "[0.11.5, )", + "NuGet.Frameworks": "[6.7.0, )", + "ResXResourceReader.NetStandard": "[1.1.0, )", + "Serilog": "[3.0.1, )", + "Serilog.Extensions.Logging": "[7.0.0, )", + "Serilog.Extensions.Logging.File": "[3.0.0, )", + "Serilog.Sinks.Console": "[4.1.0, )", + "ShellProgressBar": "[5.2.0, )", + "Spectre.Console": "[0.47.0, )", + "Spectre.Console.Analyzer": "[0.47.0, )", + "Stryker.DataCollector": "[3.10.0, )", + "Stryker.RegexMutators": "[3.10.0, )", + "TestableIO.System.IO.Abstractions.Wrappers": "[19.2.69, )" } }, "stryker.datacollector": { "type": "Project", "dependencies": { - "Microsoft.TestPlatform.ObjectModel": "17.7.2", - "Microsoft.TestPlatform.Portable": "17.7.2" + "Microsoft.TestPlatform.ObjectModel": "[17.7.2, )", + "Microsoft.TestPlatform.Portable": "[17.7.2, )" } }, "stryker.regexmutators": { "type": "Project", "dependencies": { - "RegexParser": "0.5.1" + "RegexParser": "[0.5.1, )" } }, "Buildalyzer": { "type": "CentralTransitive", - "requested": "[5.0.0, )", - "resolved": "5.0.0", - "contentHash": "iyqVWGyn/hyI/21o6fN0Mp9TYDUKOvzPlIoly4PztyJYDvbX9RgKu1XDTYYlC2CHWrViSgz/FSF9uxee7dxJPg==", + "requested": "[5.0.1, )", + "resolved": "5.0.1", + "contentHash": "q42QUS/g1O3WKNxHPgriAA5i1NbpU30TcTB5oxACgZLo1HF6zxy66OUj2ORaAYC9bQRKXd8J56i2L0vE9lMVTA==", "dependencies": { - "Buildalyzer.Logger": "5.0.0", + "Buildalyzer.Logger": "5.0.1", "MSBuild.StructuredLogger": "2.1.507", "Microsoft.Build": "16.9.0", "Microsoft.Build.Framework": "16.9.0", @@ -1917,10 +1917,10 @@ }, "YamlDotNet": { "type": "CentralTransitive", - "requested": "[13.3.1, )", - "resolved": "13.3.1", - "contentHash": "Q2dqDsb0xAlr092grgHk8/vTXI2snIiYM5ND3IXkgJDFIdPnqDYwYnlk+gwzSeRByDLhiSzTog8uT7xFwH68Zg==" + "requested": "[13.7.0, )", + "resolved": "13.7.0", + "contentHash": "RKkoQSCyk/94N20SL3U15hWAqBVXHu+59upcPi8R2uhrcAalyVa4Y/vYdXQ7MXQ71Lut//DH0tLcYByAkGmXhA==" } } } -} \ No newline at end of file +} diff --git a/src/Stryker.CLI/Stryker.CLI/packages.lock.json b/src/Stryker.CLI/Stryker.CLI/packages.lock.json index 6af9c5f5ce..bd9943fcd9 100644 --- a/src/Stryker.CLI/Stryker.CLI/packages.lock.json +++ b/src/Stryker.CLI/Stryker.CLI/packages.lock.json @@ -34,14 +34,14 @@ }, "YamlDotNet": { "type": "Direct", - "requested": "[13.3.1, )", - "resolved": "13.3.1", - "contentHash": "Q2dqDsb0xAlr092grgHk8/vTXI2snIiYM5ND3IXkgJDFIdPnqDYwYnlk+gwzSeRByDLhiSzTog8uT7xFwH68Zg==" + "requested": "[13.7.0, )", + "resolved": "13.7.0", + "contentHash": "RKkoQSCyk/94N20SL3U15hWAqBVXHu+59upcPi8R2uhrcAalyVa4Y/vYdXQ7MXQ71Lut//DH0tLcYByAkGmXhA==" }, "Buildalyzer.Logger": { "type": "Transitive", - "resolved": "5.0.0", - "contentHash": "T+bvSIWns87XNUnE9doORmjHOuH3arOTChGHA1IQlUBmKHs/WQt/0MWYZuool3egVVn/552+6c2j0eoKxPSqbw==" + "resolved": "5.0.1", + "contentHash": "7j7SzfYH69xuNFaGHbf6kRcvPUmeTUOV99+63lM0BPn2L4ThlqU7OM0aliVvlNOp5btr4nuU6kQdet5U3G7kyg==" }, "FSharp.Core": { "type": "Transitive", @@ -1458,53 +1458,53 @@ "stryker": { "type": "Project", "dependencies": { - "Buildalyzer": "5.0.0", - "DotNet.Glob": "3.1.3", - "FSharp.Compiler.Service": "41.0.7", - "Grynwald.MarkdownGenerator": "3.0.106", - "LibGit2Sharp": "0.27.2", - "Microsoft.CodeAnalysis.CSharp": "4.7.0", - "Microsoft.Extensions.Logging": "7.0.0", - "Microsoft.TestPlatform": "17.7.2", - "Microsoft.TestPlatform.ObjectModel": "17.7.2", - "Microsoft.TestPlatform.Portable": "17.7.2", - "Microsoft.TestPlatform.TranslationLayer": "17.7.2", - "Microsoft.Web.LibraryManager.Build": "2.1.175", - "Mono.Cecil": "0.11.5", - "NuGet.Frameworks": "6.7.0", - "ResXResourceReader.NetStandard": "1.1.0", - "Serilog": "3.0.1", - "Serilog.Extensions.Logging": "7.0.0", - "Serilog.Extensions.Logging.File": "3.0.0", - "Serilog.Sinks.Console": "4.1.0", - "ShellProgressBar": "5.2.0", - "Spectre.Console": "0.47.0", - "Spectre.Console.Analyzer": "0.47.0", - "Stryker.DataCollector": "1.0.0", - "Stryker.RegexMutators": "1.0.0", - "TestableIO.System.IO.Abstractions.Wrappers": "19.2.69" + "Buildalyzer": "[5.0.1, )", + "DotNet.Glob": "[3.1.3, )", + "FSharp.Compiler.Service": "[41.0.7, )", + "Grynwald.MarkdownGenerator": "[3.0.106, )", + "LibGit2Sharp": "[0.27.2, )", + "Microsoft.CodeAnalysis.CSharp": "[4.7.0, )", + "Microsoft.Extensions.Logging": "[7.0.0, )", + "Microsoft.TestPlatform": "[17.7.2, )", + "Microsoft.TestPlatform.ObjectModel": "[17.7.2, )", + "Microsoft.TestPlatform.Portable": "[17.7.2, )", + "Microsoft.TestPlatform.TranslationLayer": "[17.7.2, )", + "Microsoft.Web.LibraryManager.Build": "[2.1.175, )", + "Mono.Cecil": "[0.11.5, )", + "NuGet.Frameworks": "[6.7.0, )", + "ResXResourceReader.NetStandard": "[1.1.0, )", + "Serilog": "[3.0.1, )", + "Serilog.Extensions.Logging": "[7.0.0, )", + "Serilog.Extensions.Logging.File": "[3.0.0, )", + "Serilog.Sinks.Console": "[4.1.0, )", + "ShellProgressBar": "[5.2.0, )", + "Spectre.Console": "[0.47.0, )", + "Spectre.Console.Analyzer": "[0.47.0, )", + "Stryker.DataCollector": "[3.10.0, )", + "Stryker.RegexMutators": "[3.10.0, )", + "TestableIO.System.IO.Abstractions.Wrappers": "[19.2.69, )" } }, "stryker.datacollector": { "type": "Project", "dependencies": { - "Microsoft.TestPlatform.ObjectModel": "17.7.2", - "Microsoft.TestPlatform.Portable": "17.7.2" + "Microsoft.TestPlatform.ObjectModel": "[17.7.2, )", + "Microsoft.TestPlatform.Portable": "[17.7.2, )" } }, "stryker.regexmutators": { "type": "Project", "dependencies": { - "RegexParser": "0.5.1" + "RegexParser": "[0.5.1, )" } }, "Buildalyzer": { "type": "CentralTransitive", - "requested": "[5.0.0, )", - "resolved": "5.0.0", - "contentHash": "iyqVWGyn/hyI/21o6fN0Mp9TYDUKOvzPlIoly4PztyJYDvbX9RgKu1XDTYYlC2CHWrViSgz/FSF9uxee7dxJPg==", + "requested": "[5.0.1, )", + "resolved": "5.0.1", + "contentHash": "q42QUS/g1O3WKNxHPgriAA5i1NbpU30TcTB5oxACgZLo1HF6zxy66OUj2ORaAYC9bQRKXd8J56i2L0vE9lMVTA==", "dependencies": { - "Buildalyzer.Logger": "5.0.0", + "Buildalyzer.Logger": "5.0.1", "MSBuild.StructuredLogger": "2.1.507", "Microsoft.Build": "16.9.0", "Microsoft.Build.Framework": "16.9.0", @@ -1734,4 +1734,4 @@ } } } -} \ No newline at end of file +} diff --git a/src/Stryker.Core/Stryker.Core.UnitTest/DiffProviders/GitDiffProviderTests.cs b/src/Stryker.Core/Stryker.Core.UnitTest/DiffProviders/GitDiffProviderTests.cs index a82f3937ee..f18739c610 100644 --- a/src/Stryker.Core/Stryker.Core.UnitTest/DiffProviders/GitDiffProviderTests.cs +++ b/src/Stryker.Core/Stryker.Core.UnitTest/DiffProviders/GitDiffProviderTests.cs @@ -213,7 +213,7 @@ public void ScanDiff_Throws_Stryker_Input_Exception_When_Commit_null() public void ScanDiffReturnsListOfFiles_ExcludingTestFilesInDiffIgnoreFiles() { // Arrange - var diffIgnoreFiles = new[] { new FilePattern(Glob.Parse("/c/Users/JohnDoe/Project/Tests/Test.cs"), false, null) }; + var diffIgnoreFiles = new[] { new ExclusionPattern("/c/Users/JohnDoe/Project/Tests/Test.cs") }; var basePath = FilePathUtils.NormalizePathSeparators("/c/Users/JohnDoe/Project/Tests"); var options = new StrykerOptions() @@ -289,7 +289,7 @@ public void ScanDiffReturnsListOfFiles_ExcludingTestFilesInDiffIgnoreFiles() public void ScanDiffReturnsListOfFiles_ExcludingTestFilesInDiffIgnoreFiles_Single_Asterisk() { // Arrange - var diffIgnoreFiles = new[] { new FilePattern(Glob.Parse("/c/Users/JohnDoe/Project/*/Test.cs"), false, null) }; + var diffIgnoreFiles = new[] { new ExclusionPattern("/c/Users/JohnDoe/Project/*/Test.cs") }; var basePath = FilePathUtils.NormalizePathSeparators("/c/Users/JohnDoe/Project/Tests"); var options = new StrykerOptions() @@ -365,7 +365,7 @@ public void ScanDiffReturnsListOfFiles_ExcludingTestFilesInDiffIgnoreFiles_Singl public void ScanDiffReturnsListOfFiles_ExcludingTestFilesInDiffIgnoreFiles_Multi_Asterisk() { // Arrange - var diffIgnoreFiles = new[] { new FilePattern(Glob.Parse("**/Test.cs"), false, null) }; + var diffIgnoreFiles = new[] { new ExclusionPattern("**/Test.cs") }; var basePath = FilePathUtils.NormalizePathSeparators("/c/Users/JohnDoe/Project/Tests"); var options = new StrykerOptions() @@ -441,7 +441,7 @@ public void ScanDiffReturnsListOfFiles_ExcludingTestFilesInDiffIgnoreFiles_Multi public void ScanDiffReturnsListOfFiles_ExcludingFilesInDiffIgnoreFiles_Multi_Asterisk() { // Arrange - var diffIgnoreFiles = new[] { new FilePattern(Glob.Parse("**/file.cs"), false, null) }; + var diffIgnoreFiles = new[] { new ExclusionPattern("**/file.cs") }; var basePath = FilePathUtils.NormalizePathSeparators("/c/Users/JohnDoe/Project/Tests"); var options = new StrykerOptions() diff --git a/src/Stryker.Core/Stryker.Core.UnitTest/ExclusionPatternTests.cs b/src/Stryker.Core/Stryker.Core.UnitTest/ExclusionPatternTests.cs new file mode 100644 index 0000000000..faed616953 --- /dev/null +++ b/src/Stryker.Core/Stryker.Core.UnitTest/ExclusionPatternTests.cs @@ -0,0 +1,36 @@ +using System; +using Shouldly; +using Xunit; + +namespace Stryker.Core.UnitTest +{ + public class ExclusionPatternTests : TestBase + { + [Fact] + public void ExclusionPattern_Null() + { + _ = Assert.Throws(() => new ExclusionPattern(null)); + } + + [Fact] + public void ExclusionPattern_Globs() + { + var s1 = new ExclusionPattern(@"Person.cs"); + var s2 = new ExclusionPattern(@"!Person.cs"); + + s1.IsExcluded.ShouldBeFalse(); + s2.IsExcluded.ShouldBeTrue(); + s1.Glob.ToString().ShouldBe(s2.Glob.ToString()); + } + + [Fact] + public void ExclusionPattern_MutantSpans() + { + var s1 = new ExclusionPattern(@"src/Person.cs{10..100}"); + var s2 = new ExclusionPattern(@"src/Person.cs"); + + s1.MutantSpans.ShouldBe(new [] { (10, 100)}); + s2.MutantSpans.ShouldBeEmpty(); + } + } +} diff --git a/src/Stryker.Core/Stryker.Core.UnitTest/Options/FilePatternTests.cs b/src/Stryker.Core/Stryker.Core.UnitTest/FilePatternTests.cs similarity index 98% rename from src/Stryker.Core/Stryker.Core.UnitTest/Options/FilePatternTests.cs rename to src/Stryker.Core/Stryker.Core.UnitTest/FilePatternTests.cs index 432f764ef8..d8f8db2aeb 100644 --- a/src/Stryker.Core/Stryker.Core.UnitTest/Options/FilePatternTests.cs +++ b/src/Stryker.Core/Stryker.Core.UnitTest/FilePatternTests.cs @@ -5,7 +5,7 @@ using Shouldly; using Xunit; -namespace Stryker.Core.UnitTest.Options +namespace Stryker.Core.UnitTest { public class FilePatternTests : TestBase { diff --git a/src/Stryker.Core/Stryker.Core.UnitTest/Helpers/RangeHelperTests.cs b/src/Stryker.Core/Stryker.Core.UnitTest/Helpers/RangeHelperTests.cs new file mode 100644 index 0000000000..fcdb406878 --- /dev/null +++ b/src/Stryker.Core/Stryker.Core.UnitTest/Helpers/RangeHelperTests.cs @@ -0,0 +1,534 @@ +using System; +using System.Linq; +using FSharp.Compiler.Text; +using Shouldly; +using Stryker.Core.Helpers; +using Xunit; +using Range = FSharp.Compiler.Text.Range; + + +namespace Stryker.Core.UnitTest.Helpers +{ + public class RangeHelperTests : TestBase + { + [Fact] + public void Reduce_Empty() + { + var result = Enumerable.Empty().Reduce("test.fs"); + + result.ShouldBeEmpty(); + } + + [Fact] + public void Reduce_Hollow() + { + var range = GetRange((42, 42), (42, 42)); + + var result = new[] { range }.Reduce("test.fs"); + + result.ShouldBeEmpty(); + } + + [Fact] + public void Reduce_One() + { + var range = GetRange((0, 0), (42, 42)); + + var result = new[] { range }.Reduce("test.fs"); + + result.ShouldBe(new[] { range }); + } + + [Fact] + public void Reduce_TwoEqual() + { + var range1 = GetRange((0, 0), (42, 42)); + var range2 = GetRange((0, 0), (42, 42)); + + var result = new[] { range1, range2 }.Reduce("test.fs"); + + result.ShouldBe(new[] { range1 }); + } + + [Fact] + public void Reduce_TwoSequential() + { + var range1 = GetRange((0, 0), (11, 11)); + var range2 = GetRange((0, 0), (22, 22)); + var merged = GetRange((0, 0), (22, 22)); + + var result = new[] { range1, range2 }.Reduce("test.fs"); + + result.ShouldBe(new[] { merged }); + } + + [Fact] + public void Reduce_TwoIntersecting() + { + var range1 = GetRange((0, 0), (22, 22)); + var range2 = GetRange((11, 11), (33, 33)); + var intersection = GetRange((0, 0), (33, 33)); + + var result = new[] { range1, range2 }.Reduce("test.fs"); + + result.ShouldBe(new[] { intersection }); + } + + [Fact] + public void Reduce_TwoNotIntersecting() + { + var range1 = GetRange((0, 0), (11, 11)); + var range2 = GetRange((22, 22), (33, 33)); + + var result = new[] { range1, range2 }.Reduce("test.fs"); + + result.ShouldBe(new[] { range1, range2 }); + } + + [Fact] + public void Reduce_ThreeSequential() + { + var range1 = GetRange((0, 0), (11, 11)); + var range2 = GetRange((11, 11), (22, 22)); + var range3 = GetRange((22, 22), (33, 33)); + var merged = GetRange((0, 0), (33, 33)); + + var result = new[] { range1, range2, range3 }.Reduce("test.fs"); + + result.ShouldBe(new[] { merged }); + } + + [Fact] + public void Reduce_ThreePartiallyIntersecting() + { + var range1 = GetRange((0, 0), (22, 22)); + var range2 = GetRange((11, 11), (33, 33)); + var range3 = GetRange((44, 44), (55, 55)); + var intersection = GetRange((0, 0), (33, 33)); + + var result = new[] { range1, range2, range3 }.Reduce("test.fs"); + + result.ShouldBe(new[] { intersection, range3 }, ignoreOrder: true); + } + + [Fact] + public void RemoveOverlap_Empty() + { + var result = Enumerable.Empty().RemoveOverlap(Enumerable.Empty(), "test.fs"); + + result.ShouldBeEmpty(); + } + + [Fact] + public void RemoveOverlap_OverlappingPartiallyLeft() + { + var range1 = GetRange((0, 0), (22, 22)); + var range2 = GetRange((11, 11), (22, 22)); + var rangeWithoutOverlap = GetRange((0, 0), (11, 11)); + + var result = new[] { range1 }.RemoveOverlap(new[] { range2 }, "test.fs"); + + result.ShouldBe(new[] { rangeWithoutOverlap }); + } + + [Fact] + public void RemoveOverlap_OverlappingPartiallyRight() + { + var range1 = GetRange((0, 0), (22, 22)); + var range2 = GetRange((0, 0), (11, 11)); + var rangeWithoutOverlap = GetRange((11, 11), (22, 22)); + + var result = new[] { range1 }.RemoveOverlap(new[] { range2 }, "test.fs"); + + result.ShouldBe(new[] { rangeWithoutOverlap }); + } + + [Fact] + public void RemoveOverlap_OverlappingBySequentialRanges() + { + var range1 = GetRange((0, 0), (33, 33)); + var range2 = GetRange((0, 0), (11, 11)); + var range3 = GetRange((11, 11), (22, 22)); + var rangeWithoutOverlap = GetRange((22, 22), (33, 33)); + + var result = new[] { range1 }.RemoveOverlap(new[] { range2, range3 }, "test.fs"); + + result.ShouldBe(new[] { rangeWithoutOverlap }); + } + + [Fact] + public void RemoveOverlap_OverlappingByRangesFromSides() + { + var range1 = GetRange((0, 0), (33, 33)); + var range2 = GetRange((0, 0), (11, 11)); + var range3 = GetRange((22, 22), (33, 33)); + var rangeWithoutOverlap = GetRange((11, 11), (22, 22)); + + var result = new[] { range1 }.RemoveOverlap(new[] { range2, range3 }, "test.fs"); + + result.ShouldBe(new[] { rangeWithoutOverlap }); + } + + [Fact] + public void RemoveOverlap_OverlappingCompletely() + { + var range1 = GetRange((0, 0), (42, 42)); + var range2 = GetRange((0, 0), (42, 42)); + + var result = new[] { range1 }.RemoveOverlap(new[] { range2 }, "test.fs"); + + result.ShouldBeEmpty(); + } + + [Fact] + public void RemoveOverlap_OverlappingByBigger() + { + var range1 = GetRange((0, 0), (11, 11)); + var range2 = GetRange((0, 0), (44, 44)); + + var result = new[] { range1 }.RemoveOverlap(new[] { range2 }, "test.fs"); + + result.ShouldBeEmpty(); + } + + [Fact] + public void RemoveOverlap_CutInTheMiddle() + { + var range1 = GetRange((0, 0), (33, 33)); + var range2 = GetRange((11, 11), (22, 22)); + var leftPart = GetRange((0, 0), (11, 11)); + var rightPart = GetRange((22, 22), (33, 33)); + + var result = new[] { range1 }.RemoveOverlap(new[] { range2 }, "test.fs"); + + result.ShouldBe(new[] { leftPart, rightPart }); + } + + [Fact] + public void RemoveOverlap_NotOverlapping() + { + var range1 = GetRange((0, 0), (11, 11)); + var range2 = GetRange((22, 22), (33, 33)); + + var result = new[] { range1 }.RemoveOverlap(new[] { range2 }, "test.fs"); + + result.ShouldBe(new[] { range1 }); + } + + [Fact] + public void OverlapsWith_OverlappingLeft() + { + var range1 = GetRange((0, 0), (22, 22)); + var range2 = GetRange((11, 11), (33, 33)); + + range1.OverlapsWith(range2).ShouldBeTrue(); + } + + [Fact] + public void OverlapsWith_OverlappingRight() + { + var range1 = GetRange((11, 11), (33, 33)); + var range2 = GetRange((0, 0), (22, 22)); + + range1.OverlapsWith(range2).ShouldBeTrue(); + } + + [Fact] + public void OverlapsWith_OverlappingBetween() + { + var range1 = GetRange((0, 0), (33, 33)); + var range2 = GetRange((11, 11), (22, 22)); + + range1.OverlapsWith(range2).ShouldBeTrue(); + } + + [Fact] + public void OverlapsWith_NotOverlapping() + { + var range1 = GetRange((0, 0), (11, 11)); + var range2 = GetRange((22, 22), (33, 33)); + + range1.OverlapsWith(range2).ShouldBeFalse(); + } + + [Fact] + public void OverlapsWith_EmptyLeft() + { + var range1 = GetRange((0, 0), (42, 42)); + var range2 = Range.Zero; + + range1.OverlapsWith(range2).ShouldBeFalse(); + } + + [Fact] + public void OverlapsWith_EmptyRight() + { + var range1 = Range.Zero; + var range2 = GetRange((0, 0), (42, 42)); + + range1.OverlapsWith(range2).ShouldBeFalse(); + } + + [Fact] + public void OverlapsWith_EmptyBoth() + { + var range1 = Range.Zero; + var range2 = Range.Zero; + + range1.OverlapsWith(range2).ShouldBeFalse(); + } + + [Fact] + public void Overlap_Overlapping() + { + var range1 = GetRange((0, 0), (22, 22)); + var range2 = GetRange((11, 11), (33, 33)); + var overlap = GetRange((11, 11), (22, 22)); + + range1.Overlap(range2, "test.fs").ShouldBe(overlap); + } + + [Fact] + public void Overlap_Sequential() + { + var range1 = GetRange((0, 0), (11, 11)); + var range2 = GetRange((11, 11), (22, 22)); + + range1.Overlap(range2, "test.fs").ShouldBeNull(); + } + + [Fact] + public void Overlap_NotOverlapping() + { + var range1 = GetRange((0, 0), (11, 11)); + var range2 = GetRange((22, 22), (33, 33)); + + range1.Overlap(range2, "test.fs").ShouldBeNull(); + } + + [Fact] + public void Max_Greater() + { + var position1 = PositionModule.mkPos(42, 42); + var position2 = PositionModule.pos0; + + var actual = RangeHelper.Max(position1, position2); + + actual.ShouldBe(position1); + } + + [Fact] + public void Max_Equal() + { + var position1 = PositionModule.pos0; + var position2 = PositionModule.pos0; + + var actual = RangeHelper.Max(position1, position2); + + actual.ShouldBe(position1); + } + + [Fact] + public void Max_Less() + { + var position1 = PositionModule.pos0; + var position2 = PositionModule.mkPos(42, 42); + + var actual = RangeHelper.Max(position1, position2); + + actual.ShouldBe(position2); + } + + [Fact] + public void Min_Greater() + { + var position1 = PositionModule.mkPos(42, 42); + var position2 = PositionModule.pos0; + + var actual = RangeHelper.Min(position1, position2); + + actual.ShouldBe(position2); + } + + [Fact] + public void Min_Equal() + { + var position1 = PositionModule.pos0; + var position2 = PositionModule.pos0; + + var actual = RangeHelper.Min(position1, position2); + + actual.ShouldBe(position2); + } + + [Fact] + public void Min_Less() + { + var position1 = PositionModule.pos0; + var position2 = PositionModule.mkPos(42, 42); + + var actual = RangeHelper.Min(position1, position2); + + actual.ShouldBe(position1); + } + + [Fact] + public void IsEmpty_ZeroRange() + { + var range = Range.Zero; + + range.IsEmpty().ShouldBeTrue(); + } + + [Fact] + public void IsEmpty_HollowRange() + { + var range = GetRange((42, 42), (42, 42)); + + range.IsEmpty().ShouldBeTrue(); + } + + [Fact] + public void IsEmpty_NotEmptyRange() + { + var range = GetRange((0, 0), (42, 42)); + + range.IsEmpty().ShouldBeFalse(); + } + + [Fact] + public void IntersectsWith_Intersecting_Left() + { + var range1 = GetRange((0, 0), (22, 22)); + var range2 = GetRange((11, 11), (33, 33)); + + range1.IntersectsWith(range2).ShouldBeTrue(); + } + + [Fact] + public void IntersectsWith_IntersectingRight() + { + var range1 = GetRange((11, 11), (33, 33)); + var range2 = GetRange((0, 0), (22, 22)); + + range1.IntersectsWith(range2).ShouldBeTrue(); + } + + [Fact] + public void IntersectsWith_IntersectingBetween() + { + var range1 = GetRange((0, 0), (33, 33)); + var range2 = GetRange((11, 11), (22, 22)); + + range1.IntersectsWith(range2).ShouldBeTrue(); + } + + [Fact] + public void IntersectsWith_NoIntersection() + { + var range1 = GetRange((0, 0), (11, 11)); + var range2 = GetRange((22, 22), (33, 33)); + + range1.IntersectsWith(range2).ShouldBeFalse(); + } + + [Fact] + public void GetPosition_OneLine() + { + var text = "Line1"; + var index = 1; + var position = PositionModule.mkPos(0, 1); + + var result = RangeHelper.GetPosition(text, index); + + result.ShouldBe(position); + } + + [Fact] + public void GetPosition_NoContent() + { + var text = ""; + var index = 0; + var position = PositionModule.mkPos(0, 0); + + var result = RangeHelper.GetPosition(text, index); + + result.ShouldBe(position); + } + + [Fact] + public void GetPosition_NoContent_OutOfBounds() + { + var text = ""; + var index = 42; + var position = PositionModule.mkPos(0, 0); + + var result = RangeHelper.GetPosition(text, index); + + result.ShouldBe(position); + } + + [Theory] + [InlineData(1, 0, 1)] + [InlineData(4, 0, 4)] + [InlineData(7, 1, 2)] + [InlineData(9, 1, 4)] + public void GetPosition_MultipleLines(int index, int expectedRow, int expectedCol) + { + var text = $"Line1{Environment.NewLine}Line2"; + var position = PositionModule.mkPos(expectedRow, expectedCol); + + var result = RangeHelper.GetPosition(text, index); + + result.ShouldBe(position); + } + + [Fact] + public void GetPosition_OutOfBounds() + { + var text = "Line1"; + var index = 42; + var position = PositionModule.mkPos(0, 5); + + var result = RangeHelper.GetPosition(text, index); + + result.ShouldBe(position); + } + + [Fact] + public void GetIndex_OneLine() => GetIndex("Line1", expectedIndex: 1, row: 0, col: 1); + + [Theory] + [InlineData(1, 0, 1)] + [InlineData(4, 0, 4)] + [InlineData(7, 1, 2)] + [InlineData(9, 1, 4)] + + public void GetIndex_MultipleLines(int expectedIndex, int row, int col) => GetIndex($"Line1{Environment.NewLine}Line2", expectedIndex, row, col); + + [Theory] + [InlineData(-1, 0, 42)] + [InlineData(-1, 1, 42)] + [InlineData(-1, 2, 0)] + [InlineData(-1, 2, 42)] + public void GetIndex_MultipleLines_OutOfBounds(int expectedIndex, int row, int col) => GetIndex($"Line1{Environment.NewLine}Line2", expectedIndex, row, col); + + [Fact] + public void GetIndex_OutOfBounds() => GetIndex("Line1", expectedIndex: -1, row: 42, col: 42); + + private static void GetIndex(string text, int expectedIndex, int row, int col) + { + var position = PositionModule.mkPos(row, col); + + var result = RangeHelper.GetIndex(text, position); + + result.ShouldBe(expectedIndex); + } + + private static Range GetRange((int Line, int Column) start, (int Line, int Column) end) => + RangeModule.mkRange( + "test.fs", + PositionModule.mkPos(start.Line, start.Column), + PositionModule.mkPos(end.Line, end.Column)); + } +} diff --git a/src/Stryker.Core/Stryker.Core.UnitTest/ProjectComponents/ProjectComponentExtensionsTests.cs b/src/Stryker.Core/Stryker.Core.UnitTest/Helpers/TextSpanHelperTests.cs similarity index 94% rename from src/Stryker.Core/Stryker.Core.UnitTest/ProjectComponents/ProjectComponentExtensionsTests.cs rename to src/Stryker.Core/Stryker.Core.UnitTest/Helpers/TextSpanHelperTests.cs index 88c3551606..c52563b257 100644 --- a/src/Stryker.Core/Stryker.Core.UnitTest/ProjectComponents/ProjectComponentExtensionsTests.cs +++ b/src/Stryker.Core/Stryker.Core.UnitTest/Helpers/TextSpanHelperTests.cs @@ -1,14 +1,14 @@ -using Microsoft.CodeAnalysis.Text; -using Shouldly; -using Stryker.Core.ProjectComponents; using System; using System.Collections.Generic; using System.Linq; +using Microsoft.CodeAnalysis.Text; +using Shouldly; +using Stryker.Core.Helpers; using Xunit; -namespace Stryker.Core.UnitTest.ProjectComponents +namespace Stryker.Core.UnitTest.Helpers { - public class ProjectComponentExtensionsTests : TestBase + public class TextSpanHelperTests : TestBase { [Theory] [InlineData(new int[0], new int[0])] diff --git a/src/Stryker.Core/Stryker.Core.UnitTest/Initialisation/TargetFrameworkResolutionTests.cs b/src/Stryker.Core/Stryker.Core.UnitTest/Initialisation/TargetFrameworkResolutionTests.cs index e74c99e6b5..ca47e30a3b 100644 --- a/src/Stryker.Core/Stryker.Core.UnitTest/Initialisation/TargetFrameworkResolutionTests.cs +++ b/src/Stryker.Core/Stryker.Core.UnitTest/Initialisation/TargetFrameworkResolutionTests.cs @@ -33,7 +33,7 @@ public TargetFrameworkResolutionTests() analyzerResultsMock .Setup(m => m.GetEnumerator()) .Returns(() => _analyzerResults.GetEnumerator()); - buildalyzerProviderMock.Setup(x => x.Provide( It.IsAny())).Returns(analyzerManagerMock.Object); + buildalyzerProviderMock.Setup(x => x.Provide(It.IsAny(), It.IsAny())).Returns(analyzerManagerMock.Object); _projectFileReader = new ProjectFileReader(null, buildalyzerProviderMock.Object); } diff --git a/src/Stryker.Core/Stryker.Core.UnitTest/Options/Inputs/BaselineCreateEnabledInputTests.cs b/src/Stryker.Core/Stryker.Core.UnitTest/Options/Inputs/BaselineCreateEnabledInputTests.cs deleted file mode 100644 index 99bfff5313..0000000000 --- a/src/Stryker.Core/Stryker.Core.UnitTest/Options/Inputs/BaselineCreateEnabledInputTests.cs +++ /dev/null @@ -1,41 +0,0 @@ -using Shouldly; -using Stryker.Core.Baseline.Providers; -using Stryker.Core.Exceptions; -using Stryker.Core.Options.Inputs; -using Stryker.Core.Reporters; -using Xunit; - -namespace Stryker.Core.UnitTest.Options.Inputs -{ - public class BaselineCreateEnabledInputTests : TestBase - { - [Fact] - public void ShouldHaveHelpText() - { - var target = new BaselineRereateEnabledInput(); - target.HelpText.ShouldBe("When enabled a new baseline will be created by doing a full run and storing the mutation results. | default: 'False'"); - } - - [Fact] - public void ShouldHaveDefault() - { - var target = new BaselineRereateEnabledInput { SuppliedInput = true }; - - var result = target.Validate(); - - target.Default.ShouldBeFalse(); - result.ShouldBeTrue(); - } - - [Fact] - public void ShouldHaveDefaultForDashboard() - { - var target = new BaselineRereateEnabledInput { SuppliedInput = false }; - - var result = target.Validate(); - - target.Default.ShouldBeFalse(); - result.ShouldBeFalse(); - } - } -} diff --git a/src/Stryker.Core/Stryker.Core.UnitTest/Options/Inputs/BaselineRecreateEnabledInputTests.cs b/src/Stryker.Core/Stryker.Core.UnitTest/Options/Inputs/BaselineRecreateEnabledInputTests.cs new file mode 100644 index 0000000000..8af7a7460b --- /dev/null +++ b/src/Stryker.Core/Stryker.Core.UnitTest/Options/Inputs/BaselineRecreateEnabledInputTests.cs @@ -0,0 +1,37 @@ +using Shouldly; +using Stryker.Core.Options.Inputs; +using Xunit; + +namespace Stryker.Core.UnitTest.Options.Inputs; + +public class BaselineRecreateEnabledInputTests : TestBase +{ + [Fact] + public void ShouldHaveHelpText() + { + var target = new BaselineRecreateEnabledInput(); + target.HelpText.ShouldBe("When enabled a new baseline will be created by doing a full run and storing the mutation results. | default: 'False'"); + } + + [Fact] + public void ShouldHaveDefault() + { + var target = new BaselineRecreateEnabledInput { SuppliedInput = true }; + + var result = target.Validate(); + + target.Default.ShouldBeFalse(); + result.ShouldBeTrue(); + } + + [Fact] + public void ShouldHaveDefaultForDashboard() + { + var target = new BaselineRecreateEnabledInput { SuppliedInput = false }; + + var result = target.Validate(); + + target.Default.ShouldBeFalse(); + result.ShouldBeFalse(); + } +} diff --git a/src/Stryker.Core/Stryker.Core.UnitTest/Options/Inputs/BaselineTargetInputTests.cs b/src/Stryker.Core/Stryker.Core.UnitTest/Options/Inputs/BaselineTargetInputTests.cs new file mode 100644 index 0000000000..0973a46ca9 --- /dev/null +++ b/src/Stryker.Core/Stryker.Core.UnitTest/Options/Inputs/BaselineTargetInputTests.cs @@ -0,0 +1,52 @@ +using Shouldly; +using Stryker.Core.Exceptions; +using Stryker.Core.Options.Inputs; +using Xunit; + +namespace Stryker.Core.UnitTest.Options.Inputs; + +public class BaselineTargetInputTests : TestBase +{ + [Fact] + public void ShouldHaveHelpText() + { + var target = new BaselineTargetInput(); + target.HelpText.ShouldBe( + "The target branch/commit to compare with the current codebase when the baseline feature is enabled. | default: 'master'"); + } + + [Fact] + public void ShouldUseSuppliedInputWhenSinceEnabled() + { + var suppliedInput = "develop"; + var validatedBaselineBranch = + new BaselineTargetInput { SuppliedInput = suppliedInput }.Validate(sinceEnabled: true); + validatedBaselineBranch.ShouldBe(suppliedInput); + } + + [Fact] + public void ShouldUseDefaultWhenSinceEnabledAndInputNull() + { + var input = new BaselineTargetInput(); + var validatedBaselineBranch = input.Validate(sinceEnabled: true); + validatedBaselineBranch.ShouldBe(input.Default); + } + + [Fact] + public void MustNotBeEmptyStringWhenSinceEnabled() + { + var ex = Assert.Throws(() => + { + new BaselineTargetInput { SuppliedInput = "" }.Validate(sinceEnabled: true); + }); + ex.Message.ShouldBe("The baseline target cannot be empty when the since feature is enabled"); + } + + [Fact] + public void ShouldNotValidateBaselineTargetWhenSinceDisabled() + { + var input = new BaselineTargetInput { SuppliedInput = "develop" }; + var validatedBaselineBranch = input.Validate(sinceEnabled: false); + validatedBaselineBranch.ShouldBe(input.Default); + } +} diff --git a/src/Stryker.Core/Stryker.Core.UnitTest/Options/Inputs/OpenReportEnabledInputTests.cs b/src/Stryker.Core/Stryker.Core.UnitTest/Options/Inputs/OpenReportEnabledInputTests.cs index c46a49a8bd..11d07dfd72 100644 --- a/src/Stryker.Core/Stryker.Core.UnitTest/Options/Inputs/OpenReportEnabledInputTests.cs +++ b/src/Stryker.Core/Stryker.Core.UnitTest/Options/Inputs/OpenReportEnabledInputTests.cs @@ -1,5 +1,4 @@ using Shouldly; -using Stryker.Core.Exceptions; using Stryker.Core.Options.Inputs; using Xunit; @@ -8,10 +7,10 @@ namespace Stryker.Core.UnitTest.Options.Inputs public class OpenReportEnabledInputTests : TestBase { [Fact] - public void ShouldHaveNoHelpText() + public void ShouldHaveHelpText() { var target = new OpenReportEnabledInput(); - target.HelpText.ShouldBe(@" | default: 'False'"); + target.HelpText.ShouldBe(@"When enabled the report will open automatically after stryker has generated the report. | default: 'False'"); } [Fact] diff --git a/src/Stryker.Core/Stryker.Core.UnitTest/Options/Inputs/SinceTargetInputTests.cs b/src/Stryker.Core/Stryker.Core.UnitTest/Options/Inputs/SinceTargetInputTests.cs index 9253d1ba22..0ee6dd025f 100644 --- a/src/Stryker.Core/Stryker.Core.UnitTest/Options/Inputs/SinceTargetInputTests.cs +++ b/src/Stryker.Core/Stryker.Core.UnitTest/Options/Inputs/SinceTargetInputTests.cs @@ -11,14 +11,16 @@ public class SinceTargetInputTests : TestBase public void ShouldHaveHelpText() { var target = new SinceTargetInput(); - target.HelpText.ShouldBe(@"The target branch/commit to compare with the current codebase when the since feature is enabled. | default: 'master'"); + target.HelpText.ShouldBe( + @"The target branch/commit to compare with the current codebase when the since feature is enabled. | default: 'master'"); } [Fact] public void ShouldUseSuppliedInputWhenSinceEnabled() { var suppliedInput = "develop"; - var validatedSinceBranch = new SinceTargetInput { SuppliedInput = suppliedInput }.Validate(sinceEnabled: true); + var validatedSinceBranch = + new SinceTargetInput { SuppliedInput = suppliedInput }.Validate(sinceEnabled: true); validatedSinceBranch.ShouldBe(suppliedInput); } @@ -43,8 +45,9 @@ public void MustNotBeEmptyStringWhenSinceEnabled() [Fact] public void ShouldNotValidateSinceTargetWhenSinceDisabled() { - var validatedSinceBranch = new SinceTargetInput { SuppliedInput = "develop" }.Validate(sinceEnabled: false); - validatedSinceBranch.ShouldBe("master"); + var input = new SinceTargetInput { SuppliedInput = "develop" }; + var validatedSinceBranch = input.Validate(sinceEnabled: false); + validatedSinceBranch.ShouldBe(input.Default); } } } diff --git a/src/Stryker.Core/Stryker.Core.UnitTest/Options/StrykerOptionsTests.cs b/src/Stryker.Core/Stryker.Core.UnitTest/Options/StrykerOptionsTests.cs index 0e539a1fb5..6e7d1eab64 100644 --- a/src/Stryker.Core/Stryker.Core.UnitTest/Options/StrykerOptionsTests.cs +++ b/src/Stryker.Core/Stryker.Core.UnitTest/Options/StrykerOptionsTests.cs @@ -26,7 +26,7 @@ public void ShouldCopyValues() DashboardUrl = "url", DevMode = true, Since = true, - DiffIgnoreChanges = new[] { new FilePattern(Glob.Parse("**"), true, null) }, + DiffIgnoreChanges = new[] { new ExclusionPattern("**") }, ExcludedMutations = new[] { Mutator.Bitwise }, FallbackVersion = "main", IgnoredMethods = new[] { new Regex("") }, diff --git a/src/Stryker.Core/Stryker.Core.UnitTest/packages.lock.json b/src/Stryker.Core/Stryker.Core.UnitTest/packages.lock.json index 2e513e70ed..513cb0bbdb 100644 --- a/src/Stryker.Core/Stryker.Core.UnitTest/packages.lock.json +++ b/src/Stryker.Core/Stryker.Core.UnitTest/packages.lock.json @@ -28,11 +28,11 @@ }, "LaunchDarkly.EventSource": { "type": "Direct", - "requested": "[5.0.1, )", - "resolved": "5.0.1", - "contentHash": "DN44Ry5M4lyrjiF7LEu0Ijco7Wm8R7mJopN+giYsYjkQlszsXdFvm3POoehIDAOtL1HHl5bZvF9k9xK034u3IA==", + "requested": "[5.1.0, )", + "resolved": "5.1.0", + "contentHash": "PztDWiMvPWODx+kfBnCroZ8Lpya4nPc7ZO4TZysOogODbVXDDPDYrdcgVivCMgf4davhGrp61ekvZc+Uy1NYMA==", "dependencies": { - "LaunchDarkly.Logging": "[1.0.1, 3.0.0)" + "LaunchDarkly.Logging": "[2.0.0, 3.0.0)" } }, "Microsoft.NET.Test.Sdk": { @@ -86,20 +86,20 @@ }, "xunit": { "type": "Direct", - "requested": "[2.5.0, )", - "resolved": "2.5.0", - "contentHash": "f2V5wuAdoaq0mRTt9UBmPbVex9HcwFYn+y7WaKUz5Xpakcrv7lhtQWBJUWNY4N3Z+o+atDBLyAALM1QWx04C6Q==", + "requested": "[2.5.2, )", + "resolved": "2.5.2", + "contentHash": "cClLEtMhn9H85jdZILz564FkBHOUP1/KmpColguzWpzXDY8cFRRZ2gW58ahdWBznz8UzRabAUqY+5vZKia+AmQ==", "dependencies": { - "xunit.analyzers": "1.2.0", - "xunit.assert": "2.5.0", - "xunit.core": "[2.5.0]" + "xunit.analyzers": "1.4.0", + "xunit.assert": "2.5.2", + "xunit.core": "[2.5.2]" } }, "xunit.runner.visualstudio": { "type": "Direct", - "requested": "[2.5.0, )", - "resolved": "2.5.0", - "contentHash": "+Gp9vuC2431yPyKB15YrOTxCuEAErBQUTIs6CquumX1F073UaPHGW0VE/XVJLMh9W4sXdz3TBkcHdFWZrRn2Hw==" + "requested": "[2.5.3, )", + "resolved": "2.5.3", + "contentHash": "HFFL6O+QLEOfs555SqHii48ovVa4CqGYanY+B32BjLpPptdE+wEJmCFNXlLHdEOD5LYeayb9EroaUpydGpcybg==" }, "Xunit.SkippableFact": { "type": "Direct", @@ -113,8 +113,8 @@ }, "Buildalyzer.Logger": { "type": "Transitive", - "resolved": "5.0.0", - "contentHash": "T+bvSIWns87XNUnE9doORmjHOuH3arOTChGHA1IQlUBmKHs/WQt/0MWYZuool3egVVn/552+6c2j0eoKxPSqbw==" + "resolved": "5.0.1", + "contentHash": "7j7SzfYH69xuNFaGHbf6kRcvPUmeTUOV99+63lM0BPn2L4ThlqU7OM0aliVvlNOp5btr4nuU6kQdet5U3G7kyg==" }, "Castle.Core": { "type": "Transitive", @@ -145,10 +145,10 @@ }, "LaunchDarkly.Logging": { "type": "Transitive", - "resolved": "1.0.1", - "contentHash": "rWgD2CIB3rvhdgN4WkwIT9JQTK1SayubtmR4efhJis/fmlhi5J4roXtkvBs07C1mU/06farZWCXdF+KnCjdfjg==", + "resolved": "2.0.0", + "contentHash": "lsLKNqAZ7HIlkdTIrf4FetfRA1SUDE3WlaZQn79aSVkLjYWEhUhkDDK7hORGh4JoA3V2gXN+cIvJQax2uR/ijA==", "dependencies": { - "Microsoft.Extensions.Logging.Abstractions": "3.1.9" + "Microsoft.Extensions.Logging.Abstractions": "6.0.0" } }, "LibGit2Sharp.NativeBinaries": { @@ -1549,30 +1549,30 @@ }, "xunit.analyzers": { "type": "Transitive", - "resolved": "1.2.0", - "contentHash": "d3dehV/DASLRlR8stWQmbPPjfYC2tct50Evav+OlsJMkfFqkhYvzO1k0s81lk0px8O0knZU/FqC8SqbXOtn+hw==" + "resolved": "1.4.0", + "contentHash": "7ljnTJfFjz5zK+Jf0h2dd2QOSO6UmFizXsojv/x4QX7TU5vEgtKZPk9RvpkiuUqg2bddtNZufBoKQalsi7djfA==" }, "xunit.assert": { "type": "Transitive", - "resolved": "2.5.0", - "contentHash": "wN84pKX5jzfpgJ0bB6arrCA/oelBeYLCpnQ9Wj5xGEVPydKzVSDY5tEatFLHE/rO0+0RC+I4H5igGE118jRh1w==", + "resolved": "2.5.2", + "contentHash": "dZNLJWG5HfMAvWBub7eDZwOkP4xuXJj1TSC2AP3bjzIFVGb8rD8xWTvgXlRBXtgPgH+I4Y5hz2MBQrGqUxjDDg==", "dependencies": { "NETStandard.Library": "1.6.1" } }, "xunit.core": { "type": "Transitive", - "resolved": "2.5.0", - "contentHash": "dnV0Mn2s1C0y2m33AylQyMkEyhBQsL4R0302kwSGiEGuY3JwzEmhTa9pnghyMRPliYSs4fXfkEAP+5bKXryGFg==", + "resolved": "2.5.2", + "contentHash": "q1PBUBD1Zxbu5WvRfdpzjUHDzs9vr65gNptEGTQmXISXMXeMG9YPX29Z7oZB0wXSccUCtwQ9uQBd5bkaCMS7hQ==", "dependencies": { - "xunit.extensibility.core": "[2.5.0]", - "xunit.extensibility.execution": "[2.5.0]" + "xunit.extensibility.core": "[2.5.2]", + "xunit.extensibility.execution": "[2.5.2]" } }, "xunit.extensibility.core": { "type": "Transitive", - "resolved": "2.5.0", - "contentHash": "xRm6NIV3i7I+LkjsAJ91Xz2fxJm/oMEi2CYq1G5HlGTgcK1Zo2wNbLO6nKX1VG5FZzXibSdoLwr/MofVvh3mFA==", + "resolved": "2.5.2", + "contentHash": "peV3Y8Pt3wNoIdHeeGClI4qKUeiEX0LuihAYqbAU0g99sidiPItMsUAURjkAoo3JqX5Lrsg+jiVukXp4Tijmfw==", "dependencies": { "NETStandard.Library": "1.6.1", "xunit.abstractions": "2.0.3" @@ -1580,63 +1580,63 @@ }, "xunit.extensibility.execution": { "type": "Transitive", - "resolved": "2.5.0", - "contentHash": "7+v2Bvp+1ew1iMGQVb1glICi8jcNdHbRUX6Ru0dmJBViGdjiS7kyqcX2VxleQhFbKNi+WF0an7/TeTXD283RlQ==", + "resolved": "2.5.2", + "contentHash": "w3Q45Rvva0z1KPtXN5j2DjY9VgBCdWT0mkkr+dZKVyzBtIxnIywzvbEFLJix/dzHdE3XYDXbzh5GfLJHGCDTUg==", "dependencies": { "NETStandard.Library": "1.6.1", - "xunit.extensibility.core": "[2.5.0]" + "xunit.extensibility.core": "[2.5.2]" } }, "stryker": { "type": "Project", "dependencies": { - "Buildalyzer": "5.0.0", - "DotNet.Glob": "3.1.3", - "FSharp.Compiler.Service": "41.0.7", - "Grynwald.MarkdownGenerator": "3.0.106", - "LibGit2Sharp": "0.27.2", - "Microsoft.CodeAnalysis.CSharp": "4.7.0", - "Microsoft.Extensions.Logging": "7.0.0", - "Microsoft.TestPlatform": "17.7.2", - "Microsoft.TestPlatform.ObjectModel": "17.7.2", - "Microsoft.TestPlatform.Portable": "17.7.2", - "Microsoft.TestPlatform.TranslationLayer": "17.7.2", - "Microsoft.Web.LibraryManager.Build": "2.1.175", - "Mono.Cecil": "0.11.5", - "NuGet.Frameworks": "6.7.0", - "ResXResourceReader.NetStandard": "1.1.0", - "Serilog": "3.0.1", - "Serilog.Extensions.Logging": "7.0.0", - "Serilog.Extensions.Logging.File": "3.0.0", - "Serilog.Sinks.Console": "4.1.0", - "ShellProgressBar": "5.2.0", - "Spectre.Console": "0.47.0", - "Spectre.Console.Analyzer": "0.47.0", - "Stryker.DataCollector": "1.0.0", - "Stryker.RegexMutators": "1.0.0", - "TestableIO.System.IO.Abstractions.Wrappers": "19.2.69" + "Buildalyzer": "[5.0.1, )", + "DotNet.Glob": "[3.1.3, )", + "FSharp.Compiler.Service": "[41.0.7, )", + "Grynwald.MarkdownGenerator": "[3.0.106, )", + "LibGit2Sharp": "[0.27.2, )", + "Microsoft.CodeAnalysis.CSharp": "[4.7.0, )", + "Microsoft.Extensions.Logging": "[7.0.0, )", + "Microsoft.TestPlatform": "[17.7.2, )", + "Microsoft.TestPlatform.ObjectModel": "[17.7.2, )", + "Microsoft.TestPlatform.Portable": "[17.7.2, )", + "Microsoft.TestPlatform.TranslationLayer": "[17.7.2, )", + "Microsoft.Web.LibraryManager.Build": "[2.1.175, )", + "Mono.Cecil": "[0.11.5, )", + "NuGet.Frameworks": "[6.7.0, )", + "ResXResourceReader.NetStandard": "[1.1.0, )", + "Serilog": "[3.0.1, )", + "Serilog.Extensions.Logging": "[7.0.0, )", + "Serilog.Extensions.Logging.File": "[3.0.0, )", + "Serilog.Sinks.Console": "[4.1.0, )", + "ShellProgressBar": "[5.2.0, )", + "Spectre.Console": "[0.47.0, )", + "Spectre.Console.Analyzer": "[0.47.0, )", + "Stryker.DataCollector": "[3.10.0, )", + "Stryker.RegexMutators": "[3.10.0, )", + "TestableIO.System.IO.Abstractions.Wrappers": "[19.2.69, )" } }, "stryker.datacollector": { "type": "Project", "dependencies": { - "Microsoft.TestPlatform.ObjectModel": "17.7.2", - "Microsoft.TestPlatform.Portable": "17.7.2" + "Microsoft.TestPlatform.ObjectModel": "[17.7.2, )", + "Microsoft.TestPlatform.Portable": "[17.7.2, )" } }, "stryker.regexmutators": { "type": "Project", "dependencies": { - "RegexParser": "0.5.1" + "RegexParser": "[0.5.1, )" } }, "Buildalyzer": { "type": "CentralTransitive", - "requested": "[5.0.0, )", - "resolved": "5.0.0", - "contentHash": "iyqVWGyn/hyI/21o6fN0Mp9TYDUKOvzPlIoly4PztyJYDvbX9RgKu1XDTYYlC2CHWrViSgz/FSF9uxee7dxJPg==", + "requested": "[5.0.1, )", + "resolved": "5.0.1", + "contentHash": "q42QUS/g1O3WKNxHPgriAA5i1NbpU30TcTB5oxACgZLo1HF6zxy66OUj2ORaAYC9bQRKXd8J56i2L0vE9lMVTA==", "dependencies": { - "Buildalyzer.Logger": "5.0.0", + "Buildalyzer.Logger": "5.0.1", "MSBuild.StructuredLogger": "2.1.507", "Microsoft.Build": "16.9.0", "Microsoft.Build.Framework": "16.9.0", @@ -1866,4 +1866,4 @@ } } } -} \ No newline at end of file +} diff --git a/src/Stryker.Core/Stryker.Core/Compiling/CsharpCompilingProcess.cs b/src/Stryker.Core/Stryker.Core/Compiling/CsharpCompilingProcess.cs index 816e9013dd..792a6031e3 100644 --- a/src/Stryker.Core/Stryker.Core/Compiling/CsharpCompilingProcess.cs +++ b/src/Stryker.Core/Stryker.Core/Compiling/CsharpCompilingProcess.cs @@ -1,6 +1,8 @@ +using System; using System.Collections.Generic; using System.IO; using System.Linq; +using System.Text; using Buildalyzer; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; @@ -74,6 +76,7 @@ public CompilingProcessResult Compile(IEnumerable syntaxTrees, Strea { _logger.LogError("Failed to build the mutated assembly due to unrecoverable error: {0}", emitResult.Diagnostics.First(diagnostic => diagnostic.Location == Location.None && diagnostic.Severity == DiagnosticSeverity.Error)); + DumpErrorDetails(emitResult.Diagnostics); throw new CompilationException("General Build Failure detected."); } @@ -154,7 +157,6 @@ private CSharpCompilation RunSourceGenerators(IAnalyzerResult analyzerResult, Co null, null), options: emitOptions); - LogEmitResult(emitResult); return (rollbackProcessResult, emitResult, retryCount+1); @@ -168,7 +170,7 @@ private void LogEmitResult(EmitResult result) foreach (var err in result.Diagnostics.Where(x => x.Severity is DiagnosticSeverity.Error)) { - _logger.LogDebug("{0}, {1}", err?.GetMessage() ?? "No message", err?.Location.SourceTree?.FilePath ?? "Unknown filepath"); + _logger.LogDebug("{ErrorMessage}, {ErrorLocation}", err?.GetMessage() ?? "No message", err?.Location?.ToString() ?? "Unknown filepath"); } } else @@ -177,6 +179,25 @@ private void LogEmitResult(EmitResult result) } } + private void DumpErrorDetails(IEnumerable diagnostics) + { + var messageBuilder = new StringBuilder(); + var materializedDiagnostics = diagnostics.ToArray(); + if (!materializedDiagnostics.Any()) + { + messageBuilder.Append("Unfortunately there is no more info available, good luck!"); + } + + foreach (var diagnostic in materializedDiagnostics) + { + messageBuilder + .Append(Environment.NewLine) + .Append(diagnostic.Id).Append(": ").AppendLine(diagnostic.ToString()); + } + + _logger.LogTrace("An unrecoverable compilation error occurred: {Diagnostics}", messageBuilder.ToString()); + } + private static string ReadableNumber(int number) => number switch { 1 => "first", diff --git a/src/Stryker.Core/Stryker.Core/ExclusionPattern.cs b/src/Stryker.Core/Stryker.Core/ExclusionPattern.cs new file mode 100644 index 0000000000..1dd75a2dfc --- /dev/null +++ b/src/Stryker.Core/Stryker.Core/ExclusionPattern.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.RegularExpressions; +using DotNet.Globbing; + +namespace Stryker.Core +{ + public readonly struct ExclusionPattern + { + private static readonly Regex _mutantSpanGroupRegex = new("(\\{(\\d+)\\.\\.(\\d+)\\})+$"); + private static readonly Regex _mutantSpanRegex = new Regex("\\{(\\d+)\\.\\.(\\d+)\\}"); + + public ExclusionPattern(string s) + { + if (s is null) + { + throw new ArgumentNullException(nameof(s)); + } + + IsExcluded = s.StartsWith('!'); + + var pattern = IsExcluded ? s[1..] : s; + var mutantSpansRegex = _mutantSpanGroupRegex.Match(pattern); + if (mutantSpansRegex.Success) + { + var filePathPart = pattern[..^mutantSpansRegex.Length]; + var normalized = FilePathUtils.NormalizePathSeparators(filePathPart); + Glob = Glob.Parse(normalized); + + MutantSpans = _mutantSpanRegex + .Matches(mutantSpansRegex.Value) + .Select(x => (int.Parse(x.Groups[1].Value), int.Parse(x.Groups[2].Value))); + } + else + { + var normalized = FilePathUtils.NormalizePathSeparators(pattern); + Glob = Glob.Parse(normalized); + MutantSpans = Enumerable.Empty<(int, int)>(); + } + } + + public bool IsExcluded { get; } + + public Glob Glob { get; } + + public IEnumerable<(int Start, int End)> MutantSpans { get; } + } +} diff --git a/src/Stryker.Core/Stryker.Core/FilePattern.cs b/src/Stryker.Core/Stryker.Core/FilePattern.cs index 49fe5facfa..44f7fb1dd2 100644 --- a/src/Stryker.Core/Stryker.Core/FilePattern.cs +++ b/src/Stryker.Core/Stryker.Core/FilePattern.cs @@ -1,10 +1,9 @@ using DotNet.Globbing; using Microsoft.CodeAnalysis.Text; -using Stryker.Core.ProjectComponents; +using Stryker.Core.Helpers; using System; using System.Collections.Generic; using System.Linq; -using System.Text.RegularExpressions; namespace Stryker.Core { @@ -13,8 +12,6 @@ namespace Stryker.Core /// public sealed class FilePattern : IEquatable { - private static readonly Regex _textSpanGroupRegex = new Regex("(\\{(\\d+)\\.\\.(\\d+)\\})+$"); - private static readonly Regex _textSpanRegex = new Regex("\\{(\\d+)\\.\\.(\\d+)\\}"); private static readonly TextSpan _textSpanMaxValue = new TextSpan(0, int.MaxValue); public FilePattern(Glob glob, bool isExclude, IReadOnlyCollection textSpans) @@ -45,47 +42,25 @@ public FilePattern(Glob glob, bool isExclude, IReadOnlyCollection text /// /// The pattern to parse. /// The - public static FilePattern Parse(string pattern) => Parse(pattern, spansEnabled: true); - - /// - /// Parses a given file pattern string. - /// Format: (!)<glob>({<spanStart>..<spanEnd>})* - /// - /// The pattern to parse. - /// Enable or disable span parsing. - /// The - public static FilePattern Parse(string pattern, bool spansEnabled) + public static FilePattern Parse(string pattern) { - var exclude = false; + var s = new ExclusionPattern(pattern); IReadOnlyCollection textSpans; - if (pattern.StartsWith('!')) - { - exclude = true; - pattern = pattern[1..]; - } - - var textSpanGroupMatch = _textSpanGroupRegex.Match(pattern); - if (!spansEnabled || !textSpanGroupMatch.Success) + if (!s.MutantSpans.Any()) { // If there are no spans specified, we add one that will cover the whole file. textSpans = new[] { _textSpanMaxValue }; } else { - // If we have one ore more spans we parse them. - var textSpansMatches = _textSpanRegex.Matches(textSpanGroupMatch.Value); - textSpans = textSpansMatches - .Select(x => TextSpan.FromBounds(int.Parse(x.Groups[1].Value), int.Parse(x.Groups[2].Value))) + textSpans = s.MutantSpans + .Select(x => TextSpan.FromBounds(x.Start, x.End)) .Reduce() .ToList(); - - pattern = pattern.Substring(0, pattern.Length - textSpanGroupMatch.Length); } - var glob = Glob.Parse(FilePathUtils.NormalizePathSeparators(pattern)); - - return new FilePattern(glob, exclude, textSpans); + return new FilePattern(s.Glob, s.IsExcluded, textSpans); } /// diff --git a/src/Stryker.Core/Stryker.Core/Helpers/RangeHelper.cs b/src/Stryker.Core/Stryker.Core/Helpers/RangeHelper.cs new file mode 100644 index 0000000000..6ce39176fd --- /dev/null +++ b/src/Stryker.Core/Stryker.Core/Helpers/RangeHelper.cs @@ -0,0 +1,198 @@ +using System.Collections.Generic; +using System.IO; +using System.Linq; +using FSharp.Compiler.Text; + +namespace Stryker.Core.Helpers +{ + public static class RangeHelper + { + /// + /// Reduces a set of ranges to the smallest set of ranges possible. + /// Two can be combined if they intersect. + /// + /// The set of s to reduce. + /// The reduced set. + public static IReadOnlyCollection Reduce(this IEnumerable ranges, string filePath) + { + var rangeList = new List(ranges); + var shouldContinue = true; + + while (shouldContinue) + { + shouldContinue = false; + + foreach (var current in rangeList) + { + // Check if any of the other ranges intersects with the current one + var other = rangeList.Find(s => !RangeModule.equals(s, current) && s.IntersectsWith(current)); + if (!RangeModule.equals(other, Range.Zero)) + { + // Remove the original ranges + rangeList.Remove(current); + rangeList.Remove(other); + + // Add the newly combined range. + rangeList.Add(FromBounds(filePath, Min(current.Start, other.Start), Max(current.End, other.End))); + + // We changed the list, so we have to restart the foreach. + shouldContinue = true; + break; + } + } + } + + return rangeList.Distinct().Where(x => !x.IsEmpty()).ToList(); + } + + /// + /// Removes all overlaps of two sets of and returns the resulting set. + /// + /// The first set. + /// The second set. + /// All ranges and part of ranges of that do not overlap with any ranges in . + public static IReadOnlyCollection RemoveOverlap(this IEnumerable left, IEnumerable right, string filePath) + { + var rangeList = new List(left); + var shouldContinue = true; + + while (shouldContinue) + { + shouldContinue = false; + + foreach (var current in rangeList) + { + // Check if any range overlaps the current range. + var other = right.FirstOrDefault(o => o.OverlapsWith(current)); + + if (!RangeModule.equals(other, Range.Zero)) + { + // Remove the current range add the new range(s). + rangeList.Remove(current); + rangeList.AddRange(RemoveOverlap(current, other)); + + // We changed the list, so we have to restart the foreach. + shouldContinue = true; + break; + } + } + } + + return rangeList; + + IReadOnlyCollection RemoveOverlap(Range current, Range other) + { + // The the current range is completely contained inside the other, nothing will be left. + if (RangeModule.rangeContainsRange(other, current)) + return System.Array.Empty(); + + // Check if there is any overlap. + var overlap = current.Overlap(other, filePath); + + if (!overlap.HasValue) + { + return new[] { current }; + } + + return new[] { FromBounds(filePath, current.Start, overlap.Value.Start), FromBounds(filePath, overlap.Value.End, current.End) }.Where(s => !s.IsEmpty()).ToList(); + } + } + + public static bool OverlapsWith(this Range range1, Range range2) + { + var overlapStart = Max(range1.Start, range2.Start); + var overlapEnd = Min(range1.End, range2.End); + + return PositionModule.posLt(overlapStart, overlapEnd); + } + + public static Range? Overlap(this Range range1, Range range2, string filePath) + { + var overlapStart = Max(range1.Start, range2.Start); + var overlapEnd = Min(range1.End, range2.End); + + return PositionModule.posLt(overlapStart, overlapEnd) + ? FromBounds(filePath, overlapStart, overlapEnd) + : null; + } + + public static Position Max(Position pos1, Position pos2) + => PositionModule.posGeq(pos1, pos2) ? pos1 : pos2; + + public static Position Min(Position pos1, Position pos2) + => PositionModule.posLt(pos1, pos2) ? pos1 : pos2; + + public static bool IsEmpty(this Range range) + => PositionModule.posEq(range.Start, range.End); + + public static bool IntersectsWith(this Range range1, Range range2) + => PositionModule.posGeq(range1.End, range2.Start) + && PositionModule.posGeq(range2.End, range1.Start); + + public static Position GetPosition(string text, int index) + { + var line = 0; + + using var reader = new StringReader(text); + var currentIndex = 0; + do + { + string? latestLineContent = reader.ReadLine(); + if (latestLineContent == null) break; + + var lengthOfThisLine = latestLineContent.Length; + var endOfLineIndex = currentIndex + lengthOfThisLine; + var indexIsOnThisLine = index <= endOfLineIndex && index >= currentIndex; + if (indexIsOnThisLine) + { + var indexOnThisLine = index - currentIndex; + return PositionModule.mkPos(line, indexOnThisLine); + } + + var thisWasTheLastLine = reader.Peek() == -1; + if (thisWasTheLastLine) + { + return PositionModule.mkPos(line, lengthOfThisLine); + } + + line++; + currentIndex += lengthOfThisLine; + } while (currentIndex < text.Length); + + return PositionModule.mkPos(0, 0); + } + + public static int GetIndex(string text, Position pos) + { + using var reader = new StringReader(text); + string? latestLineContent = ""; + var currentIndex = 0; + for (var line = 0; line <= pos.Line; ++line) + { + if (latestLineContent == null) + { + break; + } + currentIndex += latestLineContent.Length; + latestLineContent = reader.ReadLine(); + } + + if (latestLineContent != null && pos.Column < latestLineContent.Length) + { + return currentIndex + pos.Column; + } + + return -1; + } + + public static Range FromBounds(string filePath, Position startPos, Position endPos) + => RangeModule.mkRange(filePath, startPos, endPos); + + public static Range FromBounds(string filePath, string text, int startIndex, int endIndex) + { + var startPos = GetPosition(text, startIndex); + var endPos = GetPosition(text, endIndex); + return RangeModule.mkRange(filePath, startPos, endPos); + } + } +} diff --git a/src/Stryker.Core/Stryker.Core/Helpers/TextSpanHelper.cs b/src/Stryker.Core/Stryker.Core/Helpers/TextSpanHelper.cs new file mode 100644 index 0000000000..52058976de --- /dev/null +++ b/src/Stryker.Core/Stryker.Core/Helpers/TextSpanHelper.cs @@ -0,0 +1,101 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Microsoft.CodeAnalysis.Text; + +namespace Stryker.Core.Helpers +{ + public static class TextSpanHelper + { + /// + /// Reduces a set of text spans to the smallest set of text spans possible. + /// Two can be combined if they intersect. + /// + /// The set of s to reduce. + /// The reduced set. + public static IReadOnlyCollection Reduce(this IEnumerable textSpans) + { + var spans = new List(textSpans); + var shouldContinue = true; + + while (shouldContinue) + { + shouldContinue = false; + + foreach (var current in spans) + { + // Check if any of the other spans intersects with the current one + var other = spans.Find(s => s != current && s.IntersectsWith(current)); + if (other != default) + { + // Remove the original spans + spans.Remove(current); + spans.Remove(other); + + // Add the newly combined span. + spans.Add(TextSpan.FromBounds(Math.Min(current.Start, other.Start), Math.Max(current.End, other.End))); + + // We changed the list, so we have to restart the foreach. + shouldContinue = true; + break; + } + } + } + + return spans.Distinct().Where(x => !x.IsEmpty).ToList(); + } + + /// + /// Removes all overlaps of two sets of and returns the resulting set. + /// + /// The first set. + /// The second set. + /// All spans and part of spans of that do not overlap with any span in . + public static IReadOnlyCollection RemoveOverlap(this IEnumerable left, IEnumerable right) + { + var spanList = new List(left); + var shouldContinue = true; + + while (shouldContinue) + { + shouldContinue = false; + + foreach (var current in spanList) + { + // Check if any span overlaps the current span. + var other = right.FirstOrDefault(o => o.OverlapsWith(current)); + + if (other != default) + { + // Remove the current span add the new span(s). + spanList.Remove(current); + spanList.AddRange(RemoveOverlap(current, other)); + + // We changed the list, so we have to restart the foreach. + shouldContinue = true; + break; + } + } + } + + return spanList; + + IReadOnlyCollection RemoveOverlap(TextSpan current, TextSpan other) + { + // The the current span is completely contained inside the other, nothing will be left. + if (other.Contains(current)) + return Array.Empty(); + + // Check if there is any overlap. + var overlap = current.Overlap(other); + + if (!overlap.HasValue) + { + return new[] { current }; + } + + return new[] { TextSpan.FromBounds(current.Start, overlap.Value.Start), TextSpan.FromBounds(overlap.Value.End, current.End) }.Where(s => !s.IsEmpty).ToList(); + } + } + } +} diff --git a/src/Stryker.Core/Stryker.Core/Initialisation/Buildalyzer/IAnalyzerResultCSharpExtensions.cs b/src/Stryker.Core/Stryker.Core/Initialisation/Buildalyzer/IAnalyzerResultCSharpExtensions.cs new file mode 100644 index 0000000000..6343345b24 --- /dev/null +++ b/src/Stryker.Core/Stryker.Core/Initialisation/Buildalyzer/IAnalyzerResultCSharpExtensions.cs @@ -0,0 +1,41 @@ +using System; +using Buildalyzer; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp; +using Stryker.Core.Options; + +namespace Stryker.Core.Initialisation.Buildalyzer +{ + public static class IAnalyzerResultCSharpExtensions + { + public static CSharpCompilationOptions GetCompilationOptions(this IAnalyzerResult analyzerResult) + { + var compilationOptions = new CSharpCompilationOptions(analyzerResult.GetOutputKind()) + .WithNullableContextOptions(analyzerResult.GetNullableContextOptions()) + .WithAllowUnsafe(analyzerResult.GetPropertyOrDefault("AllowUnsafeBlocks", true)) + .WithAssemblyIdentityComparer(DesktopAssemblyIdentityComparer.Default) + .WithConcurrentBuild(true) + .WithModuleName(analyzerResult.GetAssemblyName()) + .WithOverflowChecks(analyzerResult.GetPropertyOrDefault("CheckForOverflowUnderflow", false)); + + if (analyzerResult.IsSignedAssembly() && analyzerResult.GetAssemblyOriginatorKeyFile() is var keyFile && keyFile is not null) + { + compilationOptions = compilationOptions.WithCryptoKeyFile(keyFile) + .WithStrongNameProvider(new DesktopStrongNameProvider()); + } + return compilationOptions; + } + + public static CSharpParseOptions GetParseOptions(this IAnalyzerResult analyzerResult, StrykerOptions options) => new CSharpParseOptions(options.LanguageVersion, DocumentationMode.None, preprocessorSymbols: analyzerResult.PreprocessorSymbols); + + private static NullableContextOptions GetNullableContextOptions(this IAnalyzerResult analyzerResult) + { + if (!Enum.TryParse(analyzerResult.GetPropertyOrDefault("Nullable", "enable"), true, out NullableContextOptions nullableOptions)) + { + nullableOptions = NullableContextOptions.Enable; + } + + return nullableOptions; + } + } +} diff --git a/src/Stryker.Core/Stryker.Core/Initialisation/Buildalyzer/IAnalyzerResultExtensions.cs b/src/Stryker.Core/Stryker.Core/Initialisation/Buildalyzer/IAnalyzerResultExtensions.cs index 7bd650b39d..4ffdba6ba9 100644 --- a/src/Stryker.Core/Stryker.Core/Initialisation/Buildalyzer/IAnalyzerResultExtensions.cs +++ b/src/Stryker.Core/Stryker.Core/Initialisation/Buildalyzer/IAnalyzerResultExtensions.cs @@ -1,17 +1,14 @@ using System; using System.Collections.Generic; -using System.Collections.Immutable; using System.IO; using System.Linq; using System.Reflection; using Buildalyzer; using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.Extensions.Logging; using NuGet.Frameworks; using Stryker.Core.Exceptions; -using Stryker.Core.Options; namespace Stryker.Core.Initialisation.Buildalyzer { @@ -34,26 +31,6 @@ public static IEnumerable GetResources(this IAnalyzerResult embeddedResources); } - public static CSharpCompilationOptions GetCompilationOptions(this IAnalyzerResult analyzerResult) - { - var compilationOptions = new CSharpCompilationOptions(analyzerResult.GetOutputKind()) - .WithNullableContextOptions(analyzerResult.GetNullableContextOptions()) - .WithAllowUnsafe(analyzerResult.GetPropertyOrDefault("AllowUnsafeBlocks", true)) - .WithAssemblyIdentityComparer(DesktopAssemblyIdentityComparer.Default) - .WithConcurrentBuild(true) - .WithModuleName(analyzerResult.GetAssemblyName()) - .WithOverflowChecks(analyzerResult.GetPropertyOrDefault("CheckForOverflowUnderflow", false)); - - if (analyzerResult.IsSignedAssembly() && analyzerResult.GetAssemblyOriginatorKeyFile() is var keyFile && keyFile is not null) - { - compilationOptions = compilationOptions.WithCryptoKeyFile(keyFile) - .WithStrongNameProvider(new DesktopStrongNameProvider()); - } - return compilationOptions; - } - - public static CSharpParseOptions GetParseOptions(this IAnalyzerResult analyzerResult, StrykerOptions options) => new CSharpParseOptions(options.LanguageVersion, DocumentationMode.None, preprocessorSymbols: analyzerResult.PreprocessorSymbols); - public static string AssemblyAttributeFileName(this IAnalyzerResult analyzerResult) => analyzerResult.GetPropertyOrDefault("GeneratedAssemblyInfoFile", (Path.GetFileNameWithoutExtension(analyzerResult.ProjectFilePath) + ".AssemblyInfo.cs") .ToLowerInvariant()); @@ -153,7 +130,7 @@ public static bool IsTestProject(this IAnalyzerResult analyzerResult) return isTestProject || hasTestProjectTypeGuid; } - private static OutputKind GetOutputKind(this IAnalyzerResult analyzerResult) => analyzerResult.GetPropertyOrDefault("OutputType") switch + internal static OutputKind GetOutputKind(this IAnalyzerResult analyzerResult) => analyzerResult.GetPropertyOrDefault("OutputType") switch { "Exe" => OutputKind.ConsoleApplication, "WinExe" => OutputKind.WindowsApplication, @@ -163,19 +140,9 @@ public static bool IsTestProject(this IAnalyzerResult analyzerResult) _ => OutputKind.DynamicallyLinkedLibrary }; - private static NullableContextOptions GetNullableContextOptions(this IAnalyzerResult analyzerResult) - { - if (!Enum.TryParse(analyzerResult.GetPropertyOrDefault("Nullable", "enable"), true, out NullableContextOptions nullableOptions)) - { - nullableOptions = NullableContextOptions.Enable; - } - - return nullableOptions; - } - - private static bool IsSignedAssembly(this IAnalyzerResult analyzerResult) => analyzerResult.GetPropertyOrDefault("SignAssembly", false); + internal static bool IsSignedAssembly(this IAnalyzerResult analyzerResult) => analyzerResult.GetPropertyOrDefault("SignAssembly", false); - private static string GetAssemblyOriginatorKeyFile(this IAnalyzerResult analyzerResult) + internal static string GetAssemblyOriginatorKeyFile(this IAnalyzerResult analyzerResult) { var assemblyKeyFileProp = analyzerResult.GetPropertyOrDefault("AssemblyOriginatorKeyFile"); if (assemblyKeyFileProp is null) @@ -188,9 +155,9 @@ private static string GetAssemblyOriginatorKeyFile(this IAnalyzerResult analyzer private static string GetRootNamespace(this IAnalyzerResult analyzerResult) => analyzerResult.GetPropertyOrDefault("RootNamespace") ?? analyzerResult.GetAssemblyName(); - private static bool GetPropertyOrDefault(this IAnalyzerResult analyzerResult, string name, bool defaultBoolean) => bool.Parse(GetPropertyOrDefault(analyzerResult, name, defaultBoolean.ToString())); + internal static bool GetPropertyOrDefault(this IAnalyzerResult analyzerResult, string name, bool defaultBoolean) => bool.Parse(GetPropertyOrDefault(analyzerResult, name, defaultBoolean.ToString())); - private static string GetPropertyOrDefault(this IAnalyzerResult analyzerResult, string name, string defaultValue = default) + internal static string GetPropertyOrDefault(this IAnalyzerResult analyzerResult, string name, string defaultValue = default) { if (analyzerResult.Properties is null || !analyzerResult.Properties.TryGetValue(name, out var property)) { diff --git a/src/Stryker.Core/Stryker.Core/Initialisation/FsharpProjectComponentsBuilder.cs b/src/Stryker.Core/Stryker.Core/Initialisation/FsharpProjectComponentsBuilder.cs index 6ca5df381c..10d01ddda6 100644 --- a/src/Stryker.Core/Stryker.Core/Initialisation/FsharpProjectComponentsBuilder.cs +++ b/src/Stryker.Core/Stryker.Core/Initialisation/FsharpProjectComponentsBuilder.cs @@ -5,6 +5,7 @@ using Microsoft.Extensions.Logging; using Microsoft.FSharp.Control; using Stryker.Core.Exceptions; +using Stryker.Core.Options; using Stryker.Core.ProjectComponents; using Stryker.Core.ProjectComponents.SourceProjects; using System; @@ -19,12 +20,14 @@ namespace Stryker.Core.Initialisation internal class FsharpProjectComponentsBuilder : ProjectComponentsBuilder { private readonly SourceProjectInfo _projectInfo; + private readonly StrykerOptions _options; private readonly string[] _foldersToExclude; private readonly ILogger _logger; - public FsharpProjectComponentsBuilder(SourceProjectInfo projectInfo, string[] foldersToExclude, ILogger logger, IFileSystem fileSystem) : base(fileSystem) + public FsharpProjectComponentsBuilder(SourceProjectInfo projectInfo, StrykerOptions options, string[] foldersToExclude, ILogger logger, IFileSystem fileSystem) : base(fileSystem) { _projectInfo = projectInfo; + _options = options; _foldersToExclude = foldersToExclude; _logger = logger; } diff --git a/src/Stryker.Core/Stryker.Core/Initialisation/InputFileResolver.cs b/src/Stryker.Core/Stryker.Core/Initialisation/InputFileResolver.cs index 7241c49f6a..4ae8f821a7 100644 --- a/src/Stryker.Core/Stryker.Core/Initialisation/InputFileResolver.cs +++ b/src/Stryker.Core/Stryker.Core/Initialisation/InputFileResolver.cs @@ -57,7 +57,7 @@ public IReadOnlyCollection ResolveSourceProjectInfos(StrykerO } else { - testProjectFileNames = new List {FindTestProject(options.ProjectPath) }; + testProjectFileNames = new List { FindTestProject(options.ProjectPath) }; } var testProjects = testProjectFileNames.Select(testProjectFile => _projectFileReader.AnalyzeProject(testProjectFile, options.SolutionPath, options.TargetFramework)).ToList(); @@ -92,7 +92,7 @@ private static Dictionary> FindDependentProjects(IReadOn { // need to scan traverse dependencies // dependents contains the list of projects depending on each (non test) projects - var dependents = projectsUnderTest.ToDictionary(p=>p.ProjectFilePath, p => new HashSet(new []{p.ProjectFilePath})); + var dependents = projectsUnderTest.ToDictionary(p => p.ProjectFilePath, p => new HashSet(new[] { p.ProjectFilePath })); // register explicit dependencies foreach (var result in projectsUnderTest) { @@ -101,7 +101,7 @@ private static Dictionary> FindDependentProjects(IReadOn dependents[reference].Add(result.ProjectFilePath); } } - + // we need to dig recursively to find recursive dependencies, until none are discovered bool foundNewDependency; do @@ -127,8 +127,8 @@ private static Dictionary> FindDependentProjects(IReadOn private List AnalyzeSolution(StrykerOptions options) { - _logger.LogInformation("Identifying projects to mutate in {0}. This can take a while.", options.SolutionPath); - var manager = _projectFileReader.AnalyzeSolution(options.SolutionPath); + _logger.LogInformation("Identifying projects to mutate in {0}. This can take a while.", options.SolutionPath); + var manager = _projectFileReader.GetAnalyzerManager(options.SolutionPath); // build all projects var projectsAnalyzerResults = new ConcurrentBag(); @@ -171,7 +171,7 @@ private IReadOnlyCollection BuildProjectInfos(StrykerOptions var projectLogName = Path.GetRelativePath(Path.GetDirectoryName(options.SolutionPath), project.ProjectFilePath); var analyzerResultsForTestProjects = testProjects .Where(testProject => testProject.ProjectReferences.Any(reference => dependents[project.ProjectFilePath].Contains(reference))); - var relatedTestProjects = analyzerResultsForTestProjects.Select(p =>p.ProjectFilePath).ToList(); + var relatedTestProjects = analyzerResultsForTestProjects.Select(p => p.ProjectFilePath).ToList(); if (relatedTestProjects.Count > 0) { _logger.LogDebug("Matched {0} to {1} test projects:", projectLogName, relatedTestProjects.Count); @@ -305,7 +305,7 @@ internal string DetermineSourceProjectWithNameFilter(StrykerOptions options, IRe stringBuilder.Append("More than one project reference matched the given project filter ") .Append($"'{options.SourceProjectName}'") .AppendLine(", please specify the full name of the project reference."); - + } stringBuilder.Append(BuildReferenceChoice(projectReferences)); @@ -370,6 +370,7 @@ private ProjectComponentsBuilder GetProjectComponentBuilder( Language.Fsharp => new FsharpProjectComponentsBuilder( projectInfo, + options, _foldersToExclude, _logger, FileSystem), diff --git a/src/Stryker.Core/Stryker.Core/Initialisation/ProjectFileReader.cs b/src/Stryker.Core/Stryker.Core/Initialisation/ProjectFileReader.cs index 4a44f7a36c..c7c6e5e344 100644 --- a/src/Stryker.Core/Stryker.Core/Initialisation/ProjectFileReader.cs +++ b/src/Stryker.Core/Stryker.Core/Initialisation/ProjectFileReader.cs @@ -16,7 +16,7 @@ IAnalyzerResult AnalyzeProject(string projectFilePath, string solutionFilePath, string targetFramework, string msBuildPath = null); - IAnalyzerManager AnalyzeSolution(string solutionPath); + IAnalyzerManager GetAnalyzerManager(string solutionFilePath = null); } /// @@ -39,13 +39,10 @@ public ProjectFileReader( _logger = ApplicationLogging.LoggerFactory.CreateLogger(); } - private IAnalyzerManager AnalyzerManager + public IAnalyzerManager GetAnalyzerManager(string solutionFilePath = null) { - get - { - _analyzerManager ??= _analyzerProvider.Provide(new AnalyzerManagerOptions{LogWriter = _buildalyzerLog}); - return _analyzerManager; - } + _analyzerManager ??= _analyzerProvider.Provide(solutionFilePath, new AnalyzerManagerOptions { LogWriter = _buildalyzerLog }); + return _analyzerManager; } public IAnalyzerResult AnalyzeProject(string projectFilePath, @@ -53,9 +50,8 @@ public IAnalyzerResult AnalyzeProject(string projectFilePath, string targetFramework, string msBuildPath = null) { - _logger.LogDebug("Analyzing project file {0}", projectFilePath); - var analyzerResult = GetProjectInfo(projectFilePath, targetFramework); + var analyzerResult = GetProjectInfo(projectFilePath, solutionFilePath, targetFramework); LogAnalyzerResult(analyzerResult); if (analyzerResult.Succeeded) @@ -67,7 +63,7 @@ public IAnalyzerResult AnalyzeProject(string projectFilePath, // buildalyzer failed to find restored packages, retry after nuget restore _logger.LogDebug("Project analyzer result not successful, restoring packages"); _nugetRestoreProcess.RestorePackages(solutionFilePath, msBuildPath); - analyzerResult = GetProjectInfo(projectFilePath, targetFramework); + analyzerResult = GetProjectInfo(projectFilePath, solutionFilePath, targetFramework); } else { @@ -78,16 +74,16 @@ public IAnalyzerResult AnalyzeProject(string projectFilePath, return analyzerResult; } - public IAnalyzerManager AnalyzeSolution(string solutionPath) => _analyzerProvider.Provide(solutionPath, new AnalyzerManagerOptions{LogWriter = _buildalyzerLog}); - /// /// Checks if project info is already present in solution projects. If not, analyze here. /// /// - private IAnalyzerResult GetProjectInfo(string projectFilePath, + private IAnalyzerResult GetProjectInfo( + string projectFilePath, + string solutionFilePath, string targetFramework) { - var analyzerResults = AnalyzerManager.GetProject(projectFilePath).Build(); + var analyzerResults = GetAnalyzerManager(solutionFilePath).GetProject(projectFilePath).Build(); return SelectAnalyzerResult(analyzerResults, targetFramework); } diff --git a/src/Stryker.Core/Stryker.Core/InjectedHelpers/MutantControl.cs b/src/Stryker.Core/Stryker.Core/InjectedHelpers/MutantControl.cs index 4b445eb668..955c6f86fa 100644 --- a/src/Stryker.Core/Stryker.Core/InjectedHelpers/MutantControl.cs +++ b/src/Stryker.Core/Stryker.Core/InjectedHelpers/MutantControl.cs @@ -1,15 +1,11 @@ -using System; -using System.Collections.Generic; -using System.Text; - namespace Stryker { internal static class MutantControl { - private static List _coveredMutants; - private static List _coveredStaticdMutants; + private static System.Collections.Generic.List _coveredMutants; + private static System.Collections.Generic.List _coveredStaticdMutants; private static string envName; - private static Object _coverageLock = new Object(); + private static System.Object _coverageLock = new System.Object(); // this attribute will be set by the Stryker Data Collector before each test public static bool CaptureCoverage; @@ -28,21 +24,21 @@ public static void InitCoverage() public static void ResetCoverage() { - _coveredMutants = new List(); - _coveredStaticdMutants = new List(); + _coveredMutants = new System.Collections.Generic.List(); + _coveredStaticdMutants = new System.Collections.Generic.List(); } - public static IList[] GetCoverageData() + public static System.Collections.Generic.IList[] GetCoverageData() { - IList[] result = new IList[]{_coveredMutants, _coveredStaticdMutants}; + System.Collections.Generic.IList[] result = new System.Collections.Generic.IList[]{_coveredMutants, _coveredStaticdMutants}; ResetCoverage(); return result; } - private static void CurrentDomain_ProcessExit(object sender, EventArgs e) + private static void CurrentDomain_ProcessExit(object sender, System.EventArgs e) { - GC.KeepAlive(_coveredMutants); - GC.KeepAlive(_coveredStaticdMutants); + System.GC.KeepAlive(_coveredMutants); + System.GC.KeepAlive(_coveredStaticdMutants); } // check with: Stryker.MutantControl.IsActive(ID) @@ -55,7 +51,7 @@ public static bool IsActive(int id) } if (ActiveMutant == ActiveMutantNotInitValue) { - string environmentVariable = Environment.GetEnvironmentVariable("ActiveMutation"); + string environmentVariable = System.Environment.GetEnvironmentVariable("ActiveMutation"); if (string.IsNullOrEmpty(environmentVariable)) { ActiveMutant = -1; diff --git a/src/Stryker.Core/Stryker.Core/Options/Inputs/BaselineCreateEnabledInput.cs b/src/Stryker.Core/Stryker.Core/Options/Inputs/BaselineCreateEnabledInput.cs index aebb47c497..2859535143 100644 --- a/src/Stryker.Core/Stryker.Core/Options/Inputs/BaselineCreateEnabledInput.cs +++ b/src/Stryker.Core/Stryker.Core/Options/Inputs/BaselineCreateEnabledInput.cs @@ -1,6 +1,6 @@ namespace Stryker.Core.Options.Inputs { - public class BaselineRereateEnabledInput : Input + public class BaselineRecreateEnabledInput : Input { public override bool Default => false; diff --git a/src/Stryker.Core/Stryker.Core/Options/Inputs/BaselineTargetInput.cs b/src/Stryker.Core/Stryker.Core/Options/Inputs/BaselineTargetInput.cs index 9f67c280bb..c56af8de77 100644 --- a/src/Stryker.Core/Stryker.Core/Options/Inputs/BaselineTargetInput.cs +++ b/src/Stryker.Core/Stryker.Core/Options/Inputs/BaselineTargetInput.cs @@ -4,7 +4,7 @@ namespace Stryker.Core.Options.Inputs { public class BaselineTargetInput : Input { - public override string Default => "main"; + public override string Default => "master"; protected override string Description => "The target branch/commit to compare with the current codebase when the baseline feature is enabled."; public string Validate(bool sinceEnabled) diff --git a/src/Stryker.Core/Stryker.Core/Options/Inputs/DiffIgnoreChangesInput.cs b/src/Stryker.Core/Stryker.Core/Options/Inputs/DiffIgnoreChangesInput.cs index 614e786a31..805ac68822 100644 --- a/src/Stryker.Core/Stryker.Core/Options/Inputs/DiffIgnoreChangesInput.cs +++ b/src/Stryker.Core/Stryker.Core/Options/Inputs/DiffIgnoreChangesInput.cs @@ -14,19 +14,19 @@ Any non-excluded files will trigger all mutants to be tested because we cannot d Use glob syntax for wildcards: https://en.wikipedia.org/wiki/Glob_(programming) Example: ['**/*Assets.json','**/favicon.ico']"; - public IEnumerable Validate() + public IEnumerable Validate() { if (SuppliedInput is { }) { - var diffIgnoreFilePatterns = new List(); + var diffIgnoreStrings = new List(); foreach (var pattern in SuppliedInput) { - diffIgnoreFilePatterns.Add(FilePattern.Parse(FilePathUtils.NormalizePathSeparators(pattern), spansEnabled: false)); + diffIgnoreStrings.Add(new ExclusionPattern(FilePathUtils.NormalizePathSeparators(pattern))); } - return diffIgnoreFilePatterns; + return diffIgnoreStrings; } - return Enumerable.Empty(); + return Enumerable.Empty(); } } } diff --git a/src/Stryker.Core/Stryker.Core/Options/StrykerInputs.cs b/src/Stryker.Core/Stryker.Core/Options/StrykerInputs.cs index f592793bbd..0898d5d61a 100644 --- a/src/Stryker.Core/Stryker.Core/Options/StrykerInputs.cs +++ b/src/Stryker.Core/Stryker.Core/Options/StrykerInputs.cs @@ -9,7 +9,7 @@ public interface IStrykerInputs AdditionalTimeoutInput AdditionalTimeoutInput { get; init; } AzureFileStorageSasInput AzureFileStorageSasInput { get; init; } AzureFileStorageUrlInput AzureFileStorageUrlInput { get; init; } - BaselineRereateEnabledInput BaselineRecreateEnabledInput { get; init; } + BaselineRecreateEnabledInput BaselineRecreateEnabledInput { get; init; } BaselineProviderInput BaselineProviderInput { get; init; } BasePathInput BasePathInput { get; init; } ConcurrencyInput ConcurrencyInput { get; init; } @@ -82,7 +82,7 @@ public StrykerInputs(IFileSystem fileSystem = null) public TestProjectsInput TestProjectsInput { get; init; } = new(); public TestCaseFilterInput TestCaseFilterInput { get; init; } = new(); public ReportersInput ReportersInput { get; init; } = new(); - public BaselineRereateEnabledInput BaselineRecreateEnabledInput { get; init; } = new(); + public BaselineRecreateEnabledInput BaselineRecreateEnabledInput { get; init; } = new(); public WithBaselineInput WithBaselineInput { get; init; } = new(); public BaselineProviderInput BaselineProviderInput { get; init; } = new(); public AzureFileStorageUrlInput AzureFileStorageUrlInput { get; init; } = new(); diff --git a/src/Stryker.Core/Stryker.Core/Options/StrykerOptions.cs b/src/Stryker.Core/Stryker.Core/Options/StrykerOptions.cs index 5ec8be761d..d6b43c42ba 100644 --- a/src/Stryker.Core/Stryker.Core/Options/StrykerOptions.cs +++ b/src/Stryker.Core/Stryker.Core/Options/StrykerOptions.cs @@ -158,7 +158,7 @@ public class StrykerOptions /// Context: When using the since feature, all tests are run again if files in the test project change (as these could impact the test results) /// When the file is present in this option the tests should not run again as the file does not impact test results. /// - public IEnumerable DiffIgnoreChanges { get; init; } = Enumerable.Empty(); + public IEnumerable DiffIgnoreChanges { get; init; } = Enumerable.Empty(); /// /// When no previous report can be found for the since feature, this commitish is used to se a baseline. diff --git a/src/Stryker.Core/Stryker.Core/ProjectComponents/ProjectComponentsExtensions.cs b/src/Stryker.Core/Stryker.Core/ProjectComponents/ProjectComponentsExtensions.cs index 6b8d7ef9df..d3b9686e9f 100644 --- a/src/Stryker.Core/Stryker.Core/ProjectComponents/ProjectComponentsExtensions.cs +++ b/src/Stryker.Core/Stryker.Core/ProjectComponents/ProjectComponentsExtensions.cs @@ -1,7 +1,6 @@ -using Microsoft.CodeAnalysis.Text; -using System; using System.Collections.Generic; using System.Linq; +using Stryker.Core.Helpers; namespace Stryker.Core.ProjectComponents { @@ -37,96 +36,5 @@ bool MatchesFilePattern(FilePattern pattern) => pattern.Glob.IsMatch(projectComponent.FullPath) || pattern.Glob.IsMatch(projectComponent.RelativePath); } - - /// - /// Reduces a set of text spans to the smallest set of text spans possible. - /// Two can be combined if they intersect. - /// - /// The set of s to reduce. - /// The reduced set. - public static IReadOnlyCollection Reduce(this IEnumerable textSpans) - { - var spans = new List(textSpans); - var shouldContinue = true; - - while (shouldContinue) - { - shouldContinue = false; - - foreach (var current in spans) - { - // Check if any of the other spans intersects with the current one - var other = spans.FirstOrDefault(s => s != current && s.IntersectsWith(current)); - if (other != default) - { - // Remove the original spans - spans.Remove(current); - spans.Remove(other); - - // Add the newly combined span. - spans.Add(TextSpan.FromBounds(Math.Min(current.Start, other.Start), Math.Max(current.End, other.End))); - - // We changed the list, so we have to restart the foreach. - shouldContinue = true; - break; - } - } - } - - return spans.Distinct().Where(x => !x.IsEmpty).ToList(); - } - - /// - /// Removes all overlaps of two sets of and returns the resulting set. - /// - /// The first set. - /// The second set. - /// All spans and part of spans of that do not overlap with any span in . - public static IReadOnlyCollection RemoveOverlap(this IEnumerable left, IEnumerable right) - { - var spanList = new List(left); - var shouldContinue = true; - - while (shouldContinue) - { - shouldContinue = false; - - foreach (var current in spanList) - { - // Check if any span overlaps the current span. - var other = right.FirstOrDefault(o => o.OverlapsWith(current)); - - if (other != default) - { - // Remove the current span add the new span(s). - spanList.Remove(current); - spanList.AddRange(RemoveOverlap(current, other)); - - // We changed the list, so we have to restart the foreach. - shouldContinue = true; - break; - } - } - } - - return spanList; - - IReadOnlyCollection RemoveOverlap(TextSpan current, TextSpan other) - { - // The the current span is completely contained inside the other, nothing will be left. - if (other.Contains(current)) - return Array.Empty(); - - // Check if there is any overlap. - var overlap = current.Overlap(other); - - if (!overlap.HasValue) - { - return new[] { current }; - } - - return new[] { TextSpan.FromBounds(current.Start, overlap.Value.Start), TextSpan.FromBounds(overlap.Value.End, current.End) }.Where(s => !s.IsEmpty).ToList(); - } - } } } diff --git a/src/Stryker.Core/Stryker.Core/ProjectComponents/TestProjects/TestProjectsInfo.cs b/src/Stryker.Core/Stryker.Core/ProjectComponents/TestProjects/TestProjectsInfo.cs index 2d995ad0a3..aee0f7970a 100644 --- a/src/Stryker.Core/Stryker.Core/ProjectComponents/TestProjects/TestProjectsInfo.cs +++ b/src/Stryker.Core/Stryker.Core/ProjectComponents/TestProjects/TestProjectsInfo.cs @@ -43,7 +43,14 @@ public void RestoreOriginalAssembly(IAnalyzerResult sourceProject) var backupFilePath = GetBackupName(injectionPath); if (_fileSystem.File.Exists(backupFilePath)) { - _fileSystem.File.Copy(backupFilePath, injectionPath, true); + try + { + _fileSystem.File.Copy(backupFilePath, injectionPath, true); + } + catch (IOException ex) + { + _logger.LogWarning(ex, "Failed to restore output assembly {Path}. Mutated assembly is still in place.", injectionPath); + } } } } diff --git a/src/Stryker.Core/Stryker.Core/packages.lock.json b/src/Stryker.Core/Stryker.Core/packages.lock.json index d6e23ea6ec..39dd545f0d 100644 --- a/src/Stryker.Core/Stryker.Core/packages.lock.json +++ b/src/Stryker.Core/Stryker.Core/packages.lock.json @@ -4,11 +4,11 @@ "net6.0": { "Buildalyzer": { "type": "Direct", - "requested": "[5.0.0, )", - "resolved": "5.0.0", - "contentHash": "iyqVWGyn/hyI/21o6fN0Mp9TYDUKOvzPlIoly4PztyJYDvbX9RgKu1XDTYYlC2CHWrViSgz/FSF9uxee7dxJPg==", + "requested": "[5.0.1, )", + "resolved": "5.0.1", + "contentHash": "q42QUS/g1O3WKNxHPgriAA5i1NbpU30TcTB5oxACgZLo1HF6zxy66OUj2ORaAYC9bQRKXd8J56i2L0vE9lMVTA==", "dependencies": { - "Buildalyzer.Logger": "5.0.0", + "Buildalyzer.Logger": "5.0.1", "MSBuild.StructuredLogger": "2.1.507", "Microsoft.Build": "16.9.0", "Microsoft.Build.Framework": "16.9.0", @@ -244,8 +244,8 @@ }, "Buildalyzer.Logger": { "type": "Transitive", - "resolved": "5.0.0", - "contentHash": "T+bvSIWns87XNUnE9doORmjHOuH3arOTChGHA1IQlUBmKHs/WQt/0MWYZuool3egVVn/552+6c2j0eoKxPSqbw==" + "resolved": "5.0.1", + "contentHash": "7j7SzfYH69xuNFaGHbf6kRcvPUmeTUOV99+63lM0BPn2L4ThlqU7OM0aliVvlNOp5btr4nuU6kQdet5U3G7kyg==" }, "FSharp.Core": { "type": "Transitive", diff --git a/src/Stryker.RegexMutators/Stryker.RegexMutators.UnitTest/packages.lock.json b/src/Stryker.RegexMutators/Stryker.RegexMutators.UnitTest/packages.lock.json index 57d41d6b8f..f6f3fbaa54 100644 --- a/src/Stryker.RegexMutators/Stryker.RegexMutators.UnitTest/packages.lock.json +++ b/src/Stryker.RegexMutators/Stryker.RegexMutators.UnitTest/packages.lock.json @@ -54,20 +54,20 @@ }, "xunit": { "type": "Direct", - "requested": "[2.5.0, )", - "resolved": "2.5.0", - "contentHash": "f2V5wuAdoaq0mRTt9UBmPbVex9HcwFYn+y7WaKUz5Xpakcrv7lhtQWBJUWNY4N3Z+o+atDBLyAALM1QWx04C6Q==", + "requested": "[2.5.2, )", + "resolved": "2.5.2", + "contentHash": "cClLEtMhn9H85jdZILz564FkBHOUP1/KmpColguzWpzXDY8cFRRZ2gW58ahdWBznz8UzRabAUqY+5vZKia+AmQ==", "dependencies": { - "xunit.analyzers": "1.2.0", - "xunit.assert": "2.5.0", - "xunit.core": "[2.5.0]" + "xunit.analyzers": "1.4.0", + "xunit.assert": "2.5.2", + "xunit.core": "[2.5.2]" } }, "xunit.runner.visualstudio": { "type": "Direct", - "requested": "[2.5.0, )", - "resolved": "2.5.0", - "contentHash": "+Gp9vuC2431yPyKB15YrOTxCuEAErBQUTIs6CquumX1F073UaPHGW0VE/XVJLMh9W4sXdz3TBkcHdFWZrRn2Hw==" + "requested": "[2.5.3, )", + "resolved": "2.5.3", + "contentHash": "HFFL6O+QLEOfs555SqHii48ovVa4CqGYanY+B32BjLpPptdE+wEJmCFNXlLHdEOD5LYeayb9EroaUpydGpcybg==" }, "DiffEngine": { "type": "Transitive", @@ -1071,30 +1071,30 @@ }, "xunit.analyzers": { "type": "Transitive", - "resolved": "1.2.0", - "contentHash": "d3dehV/DASLRlR8stWQmbPPjfYC2tct50Evav+OlsJMkfFqkhYvzO1k0s81lk0px8O0knZU/FqC8SqbXOtn+hw==" + "resolved": "1.4.0", + "contentHash": "7ljnTJfFjz5zK+Jf0h2dd2QOSO6UmFizXsojv/x4QX7TU5vEgtKZPk9RvpkiuUqg2bddtNZufBoKQalsi7djfA==" }, "xunit.assert": { "type": "Transitive", - "resolved": "2.5.0", - "contentHash": "wN84pKX5jzfpgJ0bB6arrCA/oelBeYLCpnQ9Wj5xGEVPydKzVSDY5tEatFLHE/rO0+0RC+I4H5igGE118jRh1w==", + "resolved": "2.5.2", + "contentHash": "dZNLJWG5HfMAvWBub7eDZwOkP4xuXJj1TSC2AP3bjzIFVGb8rD8xWTvgXlRBXtgPgH+I4Y5hz2MBQrGqUxjDDg==", "dependencies": { "NETStandard.Library": "1.6.1" } }, "xunit.core": { "type": "Transitive", - "resolved": "2.5.0", - "contentHash": "dnV0Mn2s1C0y2m33AylQyMkEyhBQsL4R0302kwSGiEGuY3JwzEmhTa9pnghyMRPliYSs4fXfkEAP+5bKXryGFg==", + "resolved": "2.5.2", + "contentHash": "q1PBUBD1Zxbu5WvRfdpzjUHDzs9vr65gNptEGTQmXISXMXeMG9YPX29Z7oZB0wXSccUCtwQ9uQBd5bkaCMS7hQ==", "dependencies": { - "xunit.extensibility.core": "[2.5.0]", - "xunit.extensibility.execution": "[2.5.0]" + "xunit.extensibility.core": "[2.5.2]", + "xunit.extensibility.execution": "[2.5.2]" } }, "xunit.extensibility.core": { "type": "Transitive", - "resolved": "2.5.0", - "contentHash": "xRm6NIV3i7I+LkjsAJ91Xz2fxJm/oMEi2CYq1G5HlGTgcK1Zo2wNbLO6nKX1VG5FZzXibSdoLwr/MofVvh3mFA==", + "resolved": "2.5.2", + "contentHash": "peV3Y8Pt3wNoIdHeeGClI4qKUeiEX0LuihAYqbAU0g99sidiPItMsUAURjkAoo3JqX5Lrsg+jiVukXp4Tijmfw==", "dependencies": { "NETStandard.Library": "1.6.1", "xunit.abstractions": "2.0.3" @@ -1102,11 +1102,11 @@ }, "xunit.extensibility.execution": { "type": "Transitive", - "resolved": "2.5.0", - "contentHash": "7+v2Bvp+1ew1iMGQVb1glICi8jcNdHbRUX6Ru0dmJBViGdjiS7kyqcX2VxleQhFbKNi+WF0an7/TeTXD283RlQ==", + "resolved": "2.5.2", + "contentHash": "w3Q45Rvva0z1KPtXN5j2DjY9VgBCdWT0mkkr+dZKVyzBtIxnIywzvbEFLJix/dzHdE3XYDXbzh5GfLJHGCDTUg==", "dependencies": { "NETStandard.Library": "1.6.1", - "xunit.extensibility.core": "[2.5.0]" + "xunit.extensibility.core": "[2.5.2]" } }, "stryker.regexmutators": { From 60d6d414fd2b454bd4ec4eba12423a69a84ad511 Mon Sep 17 00:00:00 2001 From: Richard Werkman Date: Fri, 13 Oct 2023 15:12:50 +0200 Subject: [PATCH 11/27] fix using --- src/Stryker.Core/Stryker.Core/StrykerRunner.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Stryker.Core/Stryker.Core/StrykerRunner.cs b/src/Stryker.Core/Stryker.Core/StrykerRunner.cs index 50a96cd20a..15837b9e44 100644 --- a/src/Stryker.Core/Stryker.Core/StrykerRunner.cs +++ b/src/Stryker.Core/Stryker.Core/StrykerRunner.cs @@ -1,4 +1,3 @@ -using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; From 8f39401b155d589ee59c141d075c80124138e630 Mon Sep 17 00:00:00 2001 From: Dani Hengeveld Date: Fri, 13 Oct 2023 17:15:08 +0200 Subject: [PATCH 12/27] Fix: StrykerCLITests info text test (#2713) * chore(deps): update dependency buildalyzer to v5.0.1 (#2665) * chore(deps): update dependency buildalyzer to v5.0.1 * Update package lock files --------- Co-authored-by: Renovatebot * chore: fix page links for site * fix: Don't fail the test run if restoring test assemblies fails (#2664) * chore(deps): update xunit-dotnet monorepo to v2.5.1 (#2673) * chore(deps): update xunit-dotnet monorepo to v2.5.1 * Update package lock files --------- Co-authored-by: Renovatebot * chore(deps): update dependency yamldotnet to v13.4.0 (#2677) * chore(deps): update dependency yamldotnet to v13.4.0 * Update package lock files --------- Co-authored-by: Renovatebot * chore: F# range math (#2679) * F# range math * Windows x Linux * Up * chore: Passing Stryker options to F# project components (#2680) Co-authored-by: Rouke Broersma * fix: Use solution file when it's available (#2690) * Use solution file when it's available * fix unit test * sonarqube * chore(compilation): Improve Error and Trace Logging (#2688) Add logs Co-authored-by: Rouke Broersma * fix: Remove usings from MutantControl (#2694) chore: remove usings from MutantControl Co-authored-by: Rouke Broersma * chore: Code quality improvements (#2696) * Use string builder in loop * Use find & handle other platform newlines * Use find * Fix duplicate message * Add more range tests * Improve range code * docs: add SAS configuration (#2676) (#2701) docs: add SAS configuration * chore(deps): update dependency launchdarkly.eventsource to v5.1.0 (#2702) * chore(deps): update dependency launchdarkly.eventsource to v5.1.0 * Update package lock files --------- Co-authored-by: Renovatebot * chore(deps): update dependency yamldotnet to v13.5.0 (#2703) * chore(deps): update dependency yamldotnet to v13.5.0 * Update package lock files --------- Co-authored-by: Renovatebot * chore(deps): update dependency yamldotnet to v13.5.1 (#2704) * chore(deps): update dependency yamldotnet to v13.5.1 * Update package lock files --------- Co-authored-by: Renovatebot * chore(deps): update dependency yamldotnet to v13.7.0 (#2705) * chore(deps): update dependency yamldotnet to v13.7.0 * Update package lock files --------- Co-authored-by: Renovatebot * chore(deps): update xunit-dotnet monorepo (#2711) * chore(deps): update xunit-dotnet monorepo * Update package lock files --------- Co-authored-by: Renovatebot * chore: Breaking down FilePattern (#2681) * Simplifying DiffIgnoreChangesInput * Update FilePattern.cs * Up * up * Rename the class * up --------- Co-authored-by: Rouke Broersma * chore: Splitting some C# related extensions in a separate file (#2697) Splitting some C# related extensions in a separate file Co-authored-by: Rouke Broersma * fix: tests for `OpenReportEnabledInput` help text * fix: typo in re(c)reate * add: tests for baseline target input. change: target input default to 'master' to stay consistent with since target input. * fix: cli info text test * also check if WithBaselineInput is true --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Renovatebot Co-authored-by: Rouke Broersma Co-authored-by: Pent Ploompuu Co-authored-by: Petr Co-authored-by: Rouke Broersma Co-authored-by: Jack Steel Co-authored-by: Cyrille DUPUYDAUBY Co-authored-by: Max S --- .../Stryker.CLI.UnitTest/StrykerCLITests.cs | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/src/Stryker.CLI/Stryker.CLI.UnitTest/StrykerCLITests.cs b/src/Stryker.CLI/Stryker.CLI.UnitTest/StrykerCLITests.cs index b8ea4725e2..0bdb5eff28 100644 --- a/src/Stryker.CLI/Stryker.CLI.UnitTest/StrykerCLITests.cs +++ b/src/Stryker.CLI/Stryker.CLI.UnitTest/StrykerCLITests.cs @@ -59,9 +59,9 @@ public void ShouldDisplayInfoOnHelp() var expected = @"Stryker: Stryker mutator for .Net -Stryker mutator for .Net +The mutation test framework for .Net -Usage: Stryker [options] +Usage: Stryker [command] [options] Options:"; sw.ToString().ShouldStartWith(expected); @@ -416,6 +416,29 @@ public void ShouldSupplyWithBaselineWhenPassed(params string[] argName) _inputs.WithBaselineInput.SuppliedInput.Value.ShouldBeTrue(); } + [Theory] + [InlineData("baseline")] + public void ShouldSupplyWithBaselineWhenCommandPassed(params string[] argName) + { + _target.Run(argName); + + _strykerRunnerMock.VerifyAll(); + + _inputs.WithBaselineInput.SuppliedInput.Value.ShouldBeTrue(); + } + + [Theory] + [InlineData("baseline", "recreate")] + public void ShouldSetBaselineRecreateWhenCommandPassed(params string[] argName) + { + _target.Run(argName); + + _strykerRunnerMock.VerifyAll(); + + _inputs.WithBaselineInput.SuppliedInput.Value.ShouldBeTrue(); + _inputs.BaselineRecreateEnabledInput.SuppliedInput.ShouldBeTrue(); + } + [Theory] [InlineData("-o", null)] [InlineData("-o:html", "html")] From dc0f060a8d9d9c164936a26a58f3ee7de70ace93 Mon Sep 17 00:00:00 2001 From: Dani Hengeveld Date: Sat, 14 Oct 2023 14:49:18 +0200 Subject: [PATCH 13/27] Pass command line arguments and options to subcommands (#2718) * fix: tests for `OpenReportEnabledInput` help text * fix: typo in re(c)reate * add: tests for baseline target input. change: target input default to 'master' to stay consistent with since target input. * fix: cli info text test * also check if WithBaselineInput is true * re-add all options to baseline and recreate commands --- src/Stryker.CLI/Stryker.CLI/StrykerCLI.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Stryker.CLI/Stryker.CLI/StrykerCLI.cs b/src/Stryker.CLI/Stryker.CLI/StrykerCLI.cs index addd39262f..62b4587fe0 100644 --- a/src/Stryker.CLI/Stryker.CLI/StrykerCLI.cs +++ b/src/Stryker.CLI/Stryker.CLI/StrykerCLI.cs @@ -75,13 +75,13 @@ public int Run(string[] args) Description = @"The target for the compare. For example, when runnin on branch feat-2 and wanting to compare to branch ""main"", set this value to ""main""", ShowInHelpText = true }; - cmdConfigReader.RegisterCliInput(app, targetInput); + cmdConfigReader.RegisterCliInput(baselineCmd, targetInput); cmdConfigReader.AddCliInput(targetInput.Input, "--target", "-t", CommandOptionType.SingleValue, InputCategory.Mutation); baselineCmd.AddOption(targetOption); baselineCmd.Command("recreate", createCmd => { cmdConfigReader.RegisterCommandLineOptions(createCmd, inputs); - cmdConfigReader.RegisterCliInput(app, targetInput); + cmdConfigReader.RegisterCliInput(createCmd, targetInput); cmdConfigReader.AddCliInput(targetInput.Input, "--target", "-t", CommandOptionType.SingleValue, InputCategory.Mutation); createCmd.AddOption(targetOption); From 0d9a5e6713a7d3bf0b82805fef3fb004a3db927c Mon Sep 17 00:00:00 2001 From: Richard Werkman Date: Fri, 2 Feb 2024 11:35:46 +0100 Subject: [PATCH 14/27] Fix build --- src/Stryker.Core/Stryker.Core/Options/StrykerInputs.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Stryker.Core/Stryker.Core/Options/StrykerInputs.cs b/src/Stryker.Core/Stryker.Core/Options/StrykerInputs.cs index 9a0c19afce..64a9e38573 100644 --- a/src/Stryker.Core/Stryker.Core/Options/StrykerInputs.cs +++ b/src/Stryker.Core/Stryker.Core/Options/StrykerInputs.cs @@ -159,8 +159,8 @@ public StrykerOptions ValidateAll() ModuleName = ModuleNameInput.Validate(), ProjectVersion = ProjectVersionInput.Validate(reporters, withBaseline), DiffIgnoreChanges = DiffIgnoreChangesInput.Validate(), - AzureFileStorageSas = AzureFileStorageSasInput.Validate(baselineProvider), - AzureFileStorageUrl = AzureFileStorageUrlInput.Validate(baselineProvider), + AzureFileStorageSas = AzureFileStorageSasInput.Validate(baselineProvider, withBaseline), + AzureFileStorageUrl = AzureFileStorageUrlInput.Validate(baselineProvider, withBaseline), BaselineRecreateEnabled = baselineCreateEnabled, WithBaseline = withBaseline, BaselineProvider = baselineProvider, From b530afa885a9b295ec5521b45a859093a67b3ab2 Mon Sep 17 00:00:00 2001 From: Richard Werkman Date: Fri, 2 Feb 2024 18:00:26 +0100 Subject: [PATCH 15/27] Refactor but I broke it... --- .../CommandLineConfigReader.cs | 48 +++++++++++++++++++ src/Stryker.CLI/Stryker.CLI/StrykerCLI.cs | 47 +----------------- .../Stryker.Core/Options/StrykerInputs.cs | 2 + 3 files changed, 52 insertions(+), 45 deletions(-) diff --git a/src/Stryker.CLI/Stryker.CLI/CommandLineConfig/CommandLineConfigReader.cs b/src/Stryker.CLI/Stryker.CLI/CommandLineConfig/CommandLineConfigReader.cs index 61810979b1..3afc940004 100644 --- a/src/Stryker.CLI/Stryker.CLI/CommandLineConfig/CommandLineConfigReader.cs +++ b/src/Stryker.CLI/Stryker.CLI/CommandLineConfig/CommandLineConfigReader.cs @@ -68,6 +68,53 @@ public void RegisterInitCommand(CommandLineApplication app, IFileSystem fileSyst }); } + public void RegisterBaselineCommand(CommandLineApplication app, IStrykerInputs inputs, string[] args, StrykerCli strykerCli) + { + app.Command("baseline", baselineCmd => + { + //RegisterCliInputs(baselineCmd); + baselineCmd.Description = "Enables the baseline feature"; + RegisterCommandLineOptions(baselineCmd, inputs); + //var targetInput = new CliInput() + //{ + // Input = new BaselineTargetInput(), + // ArgumentName = "target", + // ArgumentShortName = "t", + // Description = @"The target for the compare. For example, when runnin on branch feat-2 and wanting to compare to branch ""main"", set this value to ""main""", + // Category = InputCategory.Mutation + //}; + //var targetOption = new CommandOption("-t|--target ", CommandOptionType.SingleValue) + //{ + // LongName = "target", + // ShortName = "t", + // Description = @"The target for the compare. For example, when runnin on branch feat-2 and wanting to compare to branch ""main"", set this value to ""main""", + // ShowInHelpText = true + //}; + //RegisterCliInput(baselineCmd, targetInput); + //AddCliInput(targetInput.Input, "--target", "-t", CommandOptionType.SingleValue, InputCategory.Mutation); + //baselineCmd.AddOption(targetOption); + baselineCmd.Command("recreate", createCmd => + { + //RegisterCliInputs(createCmd); + //RegisterCommandLineOptions(createCmd, inputs); + //RegisterCliInput(createCmd, targetInput); + + createCmd.OnExecute(() => + { + inputs.WithBaselineInput.SuppliedInput = true; + createCmd.Description = "Creates a new baseline by doing a full stryker run"; + inputs.BaselineRecreateEnabledInput.SuppliedInput = true; + return strykerCli.StartApp(inputs, args, app, this); + }); + }); + baselineCmd.OnExecute(() => + { + inputs.WithBaselineInput.SuppliedInput = true; + return; + }); + }); + } + public CommandOption GetConfigFileOption(string[] args, CommandLineApplication app) { var commands = app.Parse(args); @@ -183,6 +230,7 @@ private void PrepareCliOptions(IStrykerInputs inputs) AddCliInput(inputs.MutationLevelInput, "mutation-level", "l", category: InputCategory.Mutation); AddCliInput(inputs.SinceInput, "since", "", optionType: CommandOptionType.SingleOrNoValue, argumentHint: "committish", category: InputCategory.Mutation); AddCliInput(inputs.WithBaselineInput, "with-baseline", "", optionType: CommandOptionType.SingleOrNoValue, argumentHint: "committish", category: InputCategory.Mutation); + AddCliInput(inputs.BaselineTargetInput, "target", "", argumentHint: "committish", category: InputCategory.Mutation); // Category: Reporting AddCliInput(inputs.OpenReportInput, "open-report", "o", CommandOptionType.SingleOrNoValue, argumentHint: "report-type", category: InputCategory.Reporting); AddCliInput(inputs.ReportersInput, "reporter", "r", optionType: CommandOptionType.MultipleValue, category: InputCategory.Reporting); diff --git a/src/Stryker.CLI/Stryker.CLI/StrykerCLI.cs b/src/Stryker.CLI/Stryker.CLI/StrykerCLI.cs index f296cb1b3c..8a43d4c487 100644 --- a/src/Stryker.CLI/Stryker.CLI/StrykerCLI.cs +++ b/src/Stryker.CLI/Stryker.CLI/StrykerCLI.cs @@ -11,7 +11,6 @@ using Stryker.CLI.Logging; using Stryker.Core; using Stryker.Core.Options; -using Stryker.Core.Options.Inputs; namespace Stryker.CLI { @@ -62,49 +61,7 @@ public int Run(string[] args) cmdConfigReader.RegisterCommandLineOptions(app, inputs); cmdConfigReader.RegisterInitCommand(app, _fileSystem, inputs, args); - - app.Command("baseline", baselineCmd => - { - baselineCmd.Description = "Enables the baseline feature"; - cmdConfigReader.RegisterCommandLineOptions(baselineCmd, inputs); - var targetInput = new CliInput() - { - Input = new BaselineTargetInput(), - ArgumentName = "target", - ArgumentShortName = "t", - Description = @"The target for the compare. For example, when runnin on branch feat-2 and wanting to compare to branch ""main"", set this value to ""main""", - Category = InputCategory.Mutation - }; - var targetOption = new CommandOption("-t|--target ", CommandOptionType.SingleValue) { - LongName = "target", - ShortName = "t", - Description = @"The target for the compare. For example, when runnin on branch feat-2 and wanting to compare to branch ""main"", set this value to ""main""", - ShowInHelpText = true - }; - cmdConfigReader.RegisterCliInput(baselineCmd, targetInput); - cmdConfigReader.AddCliInput(targetInput.Input, "--target", "-t", CommandOptionType.SingleValue, InputCategory.Mutation); - baselineCmd.AddOption(targetOption); - baselineCmd.Command("recreate", createCmd => - { - cmdConfigReader.RegisterCommandLineOptions(createCmd, inputs); - cmdConfigReader.RegisterCliInput(createCmd, targetInput); - cmdConfigReader.AddCliInput(targetInput.Input, "--target", "-t", CommandOptionType.SingleValue, InputCategory.Mutation); - createCmd.AddOption(targetOption); - - createCmd.OnExecute(() => - { - inputs.WithBaselineInput.SuppliedInput = true; - createCmd.Description = "Creates a new baseline by doing a full stryker run"; - inputs.BaselineRecreateEnabledInput.SuppliedInput = true; - return StartApp(inputs, args, app, cmdConfigReader); - }); - }); - baselineCmd.OnExecute(() => - { - inputs.WithBaselineInput.SuppliedInput = true; - return StartApp(inputs, args, app, cmdConfigReader); - }); - }); + cmdConfigReader.RegisterBaselineCommand(app, inputs, args, this); app.OnExecute(() => { @@ -133,7 +90,7 @@ public int Run(string[] args) } } - private int StartApp(StrykerInputs inputs, string[] args, CommandLineApplication app, CommandLineConfigReader cmdConfigReader) + internal int StartApp(IStrykerInputs inputs, string[] args, CommandLineApplication app, CommandLineConfigReader cmdConfigReader) { // app started PrintStrykerASCIIName(); diff --git a/src/Stryker.Core/Stryker.Core/Options/StrykerInputs.cs b/src/Stryker.Core/Stryker.Core/Options/StrykerInputs.cs index 64a9e38573..d785ed6cbd 100644 --- a/src/Stryker.Core/Stryker.Core/Options/StrykerInputs.cs +++ b/src/Stryker.Core/Stryker.Core/Options/StrykerInputs.cs @@ -49,6 +49,7 @@ public interface IStrykerInputs OpenReportInput OpenReportInput { get; init; } OpenReportEnabledInput OpenReportEnabledInput { get; init; } BreakOnInitialTestFailureInput BreakOnInitialTestFailureInput { get; init; } + BaselineTargetInput BaselineTargetInput { get; init; } StrykerOptions ValidateAll(); } @@ -92,6 +93,7 @@ public StrykerInputs(IFileSystem fileSystem = null) public ProjectNameInput ProjectNameInput { get; init; } = new(); public SinceInput SinceInput { get; init; } = new(); public SinceTargetInput SinceTargetInput { get; init; } = new(); + public BaselineTargetInput BaselineTargetInput { get; init; } = new(); public DiffIgnoreChangesInput DiffIgnoreChangesInput { get; init; } = new(); public FallbackVersionInput FallbackVersionInput { get; init; } = new(); public ProjectVersionInput ProjectVersionInput { get; init; } = new(); From a02f5c9b652cad7dcbcaf10341cee98bcebf79ba Mon Sep 17 00:00:00 2001 From: Richard Werkman Date: Fri, 16 Feb 2024 09:46:58 +0100 Subject: [PATCH 16/27] Fix commands --- .../CommandLineConfigReader.cs | 39 +++++-------------- 1 file changed, 10 insertions(+), 29 deletions(-) diff --git a/src/Stryker.CLI/Stryker.CLI/CommandLineConfig/CommandLineConfigReader.cs b/src/Stryker.CLI/Stryker.CLI/CommandLineConfig/CommandLineConfigReader.cs index 3afc940004..101fe219c7 100644 --- a/src/Stryker.CLI/Stryker.CLI/CommandLineConfig/CommandLineConfigReader.cs +++ b/src/Stryker.CLI/Stryker.CLI/CommandLineConfig/CommandLineConfigReader.cs @@ -72,32 +72,18 @@ public void RegisterBaselineCommand(CommandLineApplication app, IStrykerInputs i { app.Command("baseline", baselineCmd => { - //RegisterCliInputs(baselineCmd); - baselineCmd.Description = "Enables the baseline feature"; - RegisterCommandLineOptions(baselineCmd, inputs); - //var targetInput = new CliInput() - //{ - // Input = new BaselineTargetInput(), - // ArgumentName = "target", - // ArgumentShortName = "t", - // Description = @"The target for the compare. For example, when runnin on branch feat-2 and wanting to compare to branch ""main"", set this value to ""main""", - // Category = InputCategory.Mutation - //}; - //var targetOption = new CommandOption("-t|--target ", CommandOptionType.SingleValue) - //{ - // LongName = "target", - // ShortName = "t", - // Description = @"The target for the compare. For example, when runnin on branch feat-2 and wanting to compare to branch ""main"", set this value to ""main""", - // ShowInHelpText = true - //}; - //RegisterCliInput(baselineCmd, targetInput); - //AddCliInput(targetInput.Input, "--target", "-t", CommandOptionType.SingleValue, InputCategory.Mutation); - //baselineCmd.AddOption(targetOption); + RegisterCliInputs(baselineCmd); + + baselineCmd.OnExecute(() => + { + inputs.WithBaselineInput.SuppliedInput = true; + baselineCmd.Description = "Starts a stryker run based on the results of a previous run."; + return strykerCli.StartApp(inputs, args, app, this); + }); + baselineCmd.Command("recreate", createCmd => { - //RegisterCliInputs(createCmd); - //RegisterCommandLineOptions(createCmd, inputs); - //RegisterCliInput(createCmd, targetInput); + RegisterCliInputs(createCmd); createCmd.OnExecute(() => { @@ -107,11 +93,6 @@ public void RegisterBaselineCommand(CommandLineApplication app, IStrykerInputs i return strykerCli.StartApp(inputs, args, app, this); }); }); - baselineCmd.OnExecute(() => - { - inputs.WithBaselineInput.SuppliedInput = true; - return; - }); }); } From 548d06b4bee5f3d487008e1ebe6f65e7cfaf91b5 Mon Sep 17 00:00:00 2001 From: Richard Werkman Date: Fri, 16 Feb 2024 09:53:35 +0100 Subject: [PATCH 17/27] Reset mutation level --- .../Stryker.Core/Mutators/NullCoalescingExpressionMutator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Stryker.Core/Stryker.Core/Mutators/NullCoalescingExpressionMutator.cs b/src/Stryker.Core/Stryker.Core/Mutators/NullCoalescingExpressionMutator.cs index 78c377273d..26849a57a6 100644 --- a/src/Stryker.Core/Stryker.Core/Mutators/NullCoalescingExpressionMutator.cs +++ b/src/Stryker.Core/Stryker.Core/Mutators/NullCoalescingExpressionMutator.cs @@ -8,7 +8,7 @@ namespace Stryker.Core.Mutators { public class NullCoalescingExpressionMutator : MutatorBase { - public override MutationLevel MutationLevel => MutationLevel.Standard; + public override MutationLevel MutationLevel => MutationLevel.Basic; public override IEnumerable ApplyMutations(BinaryExpressionSyntax node, SemanticModel semanticModel) { From ef6392f894ff1d8c04bb3a6d592af051cd732074 Mon Sep 17 00:00:00 2001 From: Richard Werkman Date: Fri, 16 Feb 2024 11:09:03 +0100 Subject: [PATCH 18/27] Update docs --- docs/configuration.md | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/docs/configuration.md b/docs/configuration.md index 857545e829..ecd501d7b4 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -491,10 +491,10 @@ Use [globbing syntax](https://en.wikipedia.org/wiki/Glob_(programming)) for wild ## Baseline -### `with-baseline` <`flag`> [`:committish`] +### `baseline` <`command`> Default: `false` -Command line: `dotnet baseline:feat-2` +Command line: `dotnet stryker baseline` Config file: `"baseline": { }` Enabling `with-baseline` saves the mutation report to a storage location such as the filesystem. The mutation report is loaded at the start of the next mutation run. Any changed source code or unit test results in a reset of the mutants affected by the change. For unchanged mutants the previous result is reused. This feature expands on the [since](#since-flag-committish) feature by providing you with a full report after a partial mutation testrun. @@ -506,19 +506,11 @@ The report name is based on the current branch name or the [project-info.version ### `target` <`string`> Default: `false` -Command line: `dotnet baseline --target feat-2` +Command line: `dotnet stryker baseline --target feat-2` Config file: `"baseline": { "target": "feat-2" }` Set the target on the command line by passing a committish with the baseline target option. -### `baseline.enabled` <`flag`> - -Default: `null` -Command line: `N/A` -Config file: `"baseline": { "enabled": false }` - -Enable or disable [with-baseline](#with-baseline-flag-committish). If the enabled property is not set but the `baseline` object exists in the config file it is assumed to be enabled. Use this option to (temporarily) disable `with-baseline` without having to delete the other baseline configuration. - ### `baseline.fallback-version` <`string`> Default: [since-target](#since-flag-committish) @@ -591,7 +583,7 @@ Providing a subfolder is optional but allowed. In the case of a custom subfolder ### `azure-fileshare-sas` <`string`> Default: `null` -Command line: `--azure-fileshare-sas "se=2022-08-25T14%3A27Z&sp=rwdl&spr=https&sv=2021-06-08&sr=d&sdd=1&sig=XXXXXXXXXXXXX"` +Command line: `dotnet stryker baseline --azure-fileshare-sas "se=2022-08-25T14%3A27Z&sp=rwdl&spr=https&sv=2021-06-08&sr=d&sdd=1&sig=XXXXXXXXXXXXX"` Config file: `N/A` When using the azure file storage [provider](#baselineprovider-string) you must pass credentials for the fileshare to Stryker. @@ -605,10 +597,10 @@ Allowed permissions: `Read`, `Write`, `Create` For more information on how to configure a SAS check the [Azure documentation](https://docs.microsoft.com/en-us/azure/storage/common/storage-sas-overview). -### `baseline recreate` <`flag`> +### `baseline recreate` Default: `false` -Command line: `dotnet baseline recreate` +Command line: `dotnet stryker baseline recreate` Config file: `N/A` Sometimes your baseline can get corrupted or out of touch with reality. In that case the baseline can be recreated using this command. This will test all mutations in your project and save the result as the new baseline. @@ -632,7 +624,7 @@ All available loglevels are ### `log-to-file` <`flag`> -Default: `false` +Default: `false` Command line: `[-L|--log-to-file]` Config file: `N/A` From 552c9a3ed96f5b49a2796f46d4821840af93a9bb Mon Sep 17 00:00:00 2001 From: Richard Werkman Date: Fri, 16 Feb 2024 12:17:26 +0100 Subject: [PATCH 19/27] Remove "with-baseline.enabled" --- .../ConfigBuilderTests.cs | 2 +- .../Stryker.CLI.UnitTest/StrykerCLITests.cs | 6 ++-- .../CommandLineConfigReader.cs | 11 +++---- src/Stryker.CLI/Stryker.CLI/FileBasedInput.cs | 3 -- .../Stryker.CLI/FileConfigReader.cs | 7 ----- .../Stryker.CLI/FileConfigWriter.cs | 1 - .../BaselineMutantFilterTests.cs | 16 +++++----- .../MutantFilters/MutantFilterFactoryTests.cs | 4 +-- .../MutantFilters/SinceMutantFilterTests.cs | 6 ++-- .../Inputs/FallbackVersionInputTests.cs | 6 ++-- .../Inputs/ProjectVersionInputTests.cs | 10 +++---- .../Options/Inputs/ReportersInputTests.cs | 2 +- .../Options/Inputs/SinceInputTests.cs | 12 ++++---- .../Options/Inputs/WithBaselineInputTests.cs | 10 +++---- .../Options/StrykerInputsTests.cs | 14 ++++----- .../Reporters/BaselineReporterTests.cs | 2 +- .../Initialisation/ProjectOrchestrator.cs | 2 +- .../MutantFilters/BaselineMutantFilter.cs | 4 +-- .../MutantFilters/MutantFilterFactory.cs | 4 +-- .../Inputs/AzureFileStorageSasInput.cs | 4 +-- .../Inputs/AzureFileStorageUrlInput.cs | 4 +-- .../Options/Inputs/BaselineProviderInput.cs | 4 +-- .../Options/Inputs/DashboardApiKeyInput.cs | 4 +-- .../Options/Inputs/FallbackVersionInput.cs | 4 +-- .../Options/Inputs/ProjectVersionInput.cs | 6 ++-- .../Options/Inputs/ReportersInput.cs | 4 +-- .../Stryker.Core/Options/Inputs/SinceInput.cs | 4 +-- .../Options/Inputs/WithBaselineInput.cs | 4 +-- .../Stryker.Core/Options/StrykerInputs.cs | 30 +++++++++---------- .../Stryker.Core/Options/StrykerOptions.cs | 4 +-- 30 files changed, 92 insertions(+), 102 deletions(-) diff --git a/src/Stryker.CLI/Stryker.CLI.UnitTest/ConfigBuilderTests.cs b/src/Stryker.CLI/Stryker.CLI.UnitTest/ConfigBuilderTests.cs index 37a3b786c1..8047e78b9a 100644 --- a/src/Stryker.CLI/Stryker.CLI.UnitTest/ConfigBuilderTests.cs +++ b/src/Stryker.CLI/Stryker.CLI.UnitTest/ConfigBuilderTests.cs @@ -98,7 +98,7 @@ private static Mock GetMockInputs() inputs.Setup(x => x.MutateInput).Returns(new MutateInput()); inputs.Setup(x => x.MutationLevelInput).Returns(new MutationLevelInput()); inputs.Setup(x => x.SinceInput).Returns(new SinceInput()); - inputs.Setup(x => x.WithBaselineInput).Returns(new WithBaselineInput()); + inputs.Setup(x => x.BaselineEnabledInput).Returns(new BaselineEnabledInput()); inputs.Setup(x => x.OpenReportInput).Returns(new OpenReportInput()); inputs.Setup(x => x.ReportersInput).Returns(new ReportersInput()); inputs.Setup(x => x.ProjectVersionInput).Returns(new ProjectVersionInput()); diff --git a/src/Stryker.CLI/Stryker.CLI.UnitTest/StrykerCLITests.cs b/src/Stryker.CLI/Stryker.CLI.UnitTest/StrykerCLITests.cs index 0bdb5eff28..1cea090307 100644 --- a/src/Stryker.CLI/Stryker.CLI.UnitTest/StrykerCLITests.cs +++ b/src/Stryker.CLI/Stryker.CLI.UnitTest/StrykerCLITests.cs @@ -413,7 +413,7 @@ public void ShouldSupplyWithBaselineWhenPassed(params string[] argName) _strykerRunnerMock.VerifyAll(); - _inputs.WithBaselineInput.SuppliedInput.Value.ShouldBeTrue(); + _inputs.BaselineEnabledInput.SuppliedInput.Value.ShouldBeTrue(); } [Theory] @@ -424,7 +424,7 @@ public void ShouldSupplyWithBaselineWhenCommandPassed(params string[] argName) _strykerRunnerMock.VerifyAll(); - _inputs.WithBaselineInput.SuppliedInput.Value.ShouldBeTrue(); + _inputs.BaselineEnabledInput.SuppliedInput.Value.ShouldBeTrue(); } [Theory] @@ -435,7 +435,7 @@ public void ShouldSetBaselineRecreateWhenCommandPassed(params string[] argName) _strykerRunnerMock.VerifyAll(); - _inputs.WithBaselineInput.SuppliedInput.Value.ShouldBeTrue(); + _inputs.BaselineEnabledInput.SuppliedInput.Value.ShouldBeTrue(); _inputs.BaselineRecreateEnabledInput.SuppliedInput.ShouldBeTrue(); } diff --git a/src/Stryker.CLI/Stryker.CLI/CommandLineConfig/CommandLineConfigReader.cs b/src/Stryker.CLI/Stryker.CLI/CommandLineConfig/CommandLineConfigReader.cs index 101fe219c7..8efa8f97e7 100644 --- a/src/Stryker.CLI/Stryker.CLI/CommandLineConfig/CommandLineConfigReader.cs +++ b/src/Stryker.CLI/Stryker.CLI/CommandLineConfig/CommandLineConfigReader.cs @@ -76,7 +76,7 @@ public void RegisterBaselineCommand(CommandLineApplication app, IStrykerInputs i baselineCmd.OnExecute(() => { - inputs.WithBaselineInput.SuppliedInput = true; + inputs.BaselineEnabledInput.SuppliedInput = true; baselineCmd.Description = "Starts a stryker run based on the results of a previous run."; return strykerCli.StartApp(inputs, args, app, this); }); @@ -87,8 +87,9 @@ public void RegisterBaselineCommand(CommandLineApplication app, IStrykerInputs i createCmd.OnExecute(() => { - inputs.WithBaselineInput.SuppliedInput = true; + inputs.BaselineEnabledInput.SuppliedInput = true; createCmd.Description = "Creates a new baseline by doing a full stryker run"; + // Enable recreate inputs.BaselineRecreateEnabledInput.SuppliedInput = true; return strykerCli.StartApp(inputs, args, app, this); }); @@ -174,8 +175,8 @@ private static void HandleSingleOrNoValue(IInput strykerInput, CommandOption cli inputs.SinceTargetInput.SuppliedInput = cliInput.Value(); break; - case WithBaselineInput withBaselineInput: - withBaselineInput.SuppliedInput = true; + case BaselineEnabledInput baselineEnabledInput: + baselineEnabledInput.SuppliedInput = true; inputs.SinceTargetInput.SuppliedInput = cliInput.Value(); break; @@ -210,7 +211,7 @@ private void PrepareCliOptions(IStrykerInputs inputs) AddCliInput(inputs.MutateInput, "mutate", "m", optionType: CommandOptionType.MultipleValue, argumentHint: "glob-pattern", category: InputCategory.Mutation); AddCliInput(inputs.MutationLevelInput, "mutation-level", "l", category: InputCategory.Mutation); AddCliInput(inputs.SinceInput, "since", "", optionType: CommandOptionType.SingleOrNoValue, argumentHint: "committish", category: InputCategory.Mutation); - AddCliInput(inputs.WithBaselineInput, "with-baseline", "", optionType: CommandOptionType.SingleOrNoValue, argumentHint: "committish", category: InputCategory.Mutation); + AddCliInput(inputs.BaselineEnabledInput, "with-baseline", "", optionType: CommandOptionType.SingleOrNoValue, argumentHint: "committish", category: InputCategory.Mutation); AddCliInput(inputs.BaselineTargetInput, "target", "", argumentHint: "committish", category: InputCategory.Mutation); // Category: Reporting AddCliInput(inputs.OpenReportInput, "open-report", "o", CommandOptionType.SingleOrNoValue, argumentHint: "report-type", category: InputCategory.Reporting); diff --git a/src/Stryker.CLI/Stryker.CLI/FileBasedInput.cs b/src/Stryker.CLI/Stryker.CLI/FileBasedInput.cs index 5c4ae3bdb4..d8bfd5ae24 100644 --- a/src/Stryker.CLI/Stryker.CLI/FileBasedInput.cs +++ b/src/Stryker.CLI/Stryker.CLI/FileBasedInput.cs @@ -112,9 +112,6 @@ public class Since : IExtraData public class Baseline : IExtraData { - [JsonPropertyName("enabled")] - public bool? Enabled { get; init; } - [JsonPropertyName("provider")] public string Provider { get; init; } diff --git a/src/Stryker.CLI/Stryker.CLI/FileConfigReader.cs b/src/Stryker.CLI/Stryker.CLI/FileConfigReader.cs index e98671a5cb..69f26827f4 100644 --- a/src/Stryker.CLI/Stryker.CLI/FileConfigReader.cs +++ b/src/Stryker.CLI/Stryker.CLI/FileConfigReader.cs @@ -33,18 +33,11 @@ public static void DeserializeConfig(string configFilePath, IStrykerInputs input if (config.Baseline is not null) { - // Baseline is implicitly enabled when the object exists in the file config - inputs.WithBaselineInput.SuppliedInput = config.Baseline.Enabled ?? true; - inputs.BaselineProviderInput.SuppliedInput = config.Baseline.Provider; inputs.FallbackVersionInput.SuppliedInput = config.Baseline.FallbackVersion; inputs.AzureFileStorageUrlInput.SuppliedInput = config.Baseline.AzureFileShareUrl; } - inputs.WithBaselineInput.SuppliedInput = - config.Baseline is not null && - (config.Baseline.Enabled.HasValue && config.Baseline.Enabled.Value); - inputs.CoverageAnalysisInput.SuppliedInput = config.CoverageAnalysis; inputs.DisableBailInput.SuppliedInput = config.DisableBail; inputs.DisableMixMutantsInput.SuppliedInput = config.DisableMixMutants; diff --git a/src/Stryker.CLI/Stryker.CLI/FileConfigWriter.cs b/src/Stryker.CLI/Stryker.CLI/FileConfigWriter.cs index affef2425c..113aff755a 100644 --- a/src/Stryker.CLI/Stryker.CLI/FileConfigWriter.cs +++ b/src/Stryker.CLI/Stryker.CLI/FileConfigWriter.cs @@ -20,7 +20,6 @@ private static FileBasedInputOuter CreateConfig(IStrykerInputs inputs) { Baseline = new Baseline { - Enabled = inputs.WithBaselineInput.SuppliedInput ?? inputs.WithBaselineInput.Default, Provider = inputs.BaselineProviderInput.SuppliedInput ?? inputs.BaselineProviderInput.Default, FallbackVersion = inputs.FallbackVersionInput.SuppliedInput ?? inputs.FallbackVersionInput.Default, AzureFileShareUrl = inputs.AzureFileStorageUrlInput.SuppliedInput ?? inputs.AzureFileStorageUrlInput.Default, diff --git a/src/Stryker.Core/Stryker.Core.UnitTest/MutantFilters/BaselineMutantFilterTests.cs b/src/Stryker.Core/Stryker.Core.UnitTest/MutantFilters/BaselineMutantFilterTests.cs index 6e96db01a7..0068537537 100644 --- a/src/Stryker.Core/Stryker.Core.UnitTest/MutantFilters/BaselineMutantFilterTests.cs +++ b/src/Stryker.Core/Stryker.Core.UnitTest/MutantFilters/BaselineMutantFilterTests.cs @@ -46,7 +46,7 @@ public void GetBaseline_UsesBaselineFallbackVersion_WhenReportForCurrentVersionN var options = new StrykerOptions() { - WithBaseline = true, + BaselineEnabled = true, DashboardApiKey = "Acces_Token", ProjectName = "github.com/JohnDoe/project", ProjectVersion = "version/human/readable", @@ -83,7 +83,7 @@ public void GetBaseline_UsesFallbackVersion_WhenBaselineFallbackVersionNotFound( var options = new StrykerOptions() { - WithBaseline = true, + BaselineEnabled = true, DashboardApiKey = "Acces_Token", ProjectName = "github.com/JohnDoe/project", ProjectVersion = "version/human/readable", @@ -121,7 +121,7 @@ public void GetBaseline_UsesCurrentVersionReport_IfReportExists() var options = new StrykerOptions() { - WithBaseline = true, + BaselineEnabled = true, DashboardApiKey = "Access_Token", ProjectName = "github.com/JohnDoe/project", ProjectVersion = "version/human/readable", @@ -155,7 +155,7 @@ public void FilterMutantsReturnAllMutantsWhenCompareToDashboardEnabledAndBaselin var options = new StrykerOptions() { - WithBaseline = true, + BaselineEnabled = true, ProjectVersion = "version", }; @@ -187,7 +187,7 @@ public void FilterMutants_WhenMutantSourceCodeIsNull_MutantIsReturned() var options = new StrykerOptions() { - WithBaseline = true, + BaselineEnabled = true, ProjectVersion = "version", }; var file = new CsharpFileLeaf @@ -239,7 +239,7 @@ public void FilterMutants_WhenMutantMatchesSourceCode_StatusIsSetToJsonMutant() var options = new StrykerOptions() { - WithBaseline = true, + BaselineEnabled = true, ProjectVersion = "version", }; var file = new CsharpFileLeaf @@ -302,7 +302,7 @@ public void FilterMutants_WhenMultipleMatchingMutants_ResultIsSetToNotRun() var options = new StrykerOptions() { - WithBaseline = true, + BaselineEnabled = true, ProjectVersion = "version", }; var file = new CsharpFileLeaf @@ -375,7 +375,7 @@ public void ShouldNotUpdateMutantsWithBaselineIfFileNotInBaseline() var options = new StrykerOptions { - WithBaseline = true, + BaselineEnabled = true, ProjectVersion = "version" }; diff --git a/src/Stryker.Core/Stryker.Core.UnitTest/MutantFilters/MutantFilterFactoryTests.cs b/src/Stryker.Core/Stryker.Core.UnitTest/MutantFilters/MutantFilterFactoryTests.cs index c61788597a..b7e67b94df 100644 --- a/src/Stryker.Core/Stryker.Core.UnitTest/MutantFilters/MutantFilterFactoryTests.cs +++ b/src/Stryker.Core/Stryker.Core.UnitTest/MutantFilters/MutantFilterFactoryTests.cs @@ -112,7 +112,7 @@ public void MutantFilterFactory_Creates_ExcludeLinqExpressionFilter_When_Exclude public void MutantFilterFactory_Creates_DashboardMutantFilter_And_DiffMutantFilter_WithBaseline_Enabled() { var options = new StrykerOptions() { - WithBaseline = true, + BaselineEnabled = true, ProjectVersion = "foo" }; @@ -136,7 +136,7 @@ public void MutantFilterFactory_Creates_BlockMutantFilter_Last() var options = new StrykerOptions() { // These options are added here to make sure this test covers all branches in the source method. - WithBaseline = true, + BaselineEnabled = true, ExcludedLinqExpressions = new List { LinqExpression.Distinct diff --git a/src/Stryker.Core/Stryker.Core.UnitTest/MutantFilters/SinceMutantFilterTests.cs b/src/Stryker.Core/Stryker.Core.UnitTest/MutantFilters/SinceMutantFilterTests.cs index 8b71a3b22f..5eedbf4a9e 100644 --- a/src/Stryker.Core/Stryker.Core.UnitTest/MutantFilters/SinceMutantFilterTests.cs +++ b/src/Stryker.Core/Stryker.Core.UnitTest/MutantFilters/SinceMutantFilterTests.cs @@ -233,7 +233,7 @@ public void FilterMutants_FiltersNoMutants_IfTestsChanged() var options = new StrykerOptions() { - WithBaseline = false, + BaselineEnabled = false, ProjectVersion = "version" }; @@ -277,7 +277,7 @@ public void Should_IgnoreMutants_WithoutCoveringTestsInfo_When_Tests_Have_Change var options = new StrykerOptions() { - WithBaseline = false, + BaselineEnabled = false, ProjectVersion = "version" }; @@ -308,7 +308,7 @@ public void Should_ReturnAllMutants_When_NonSourceCodeFile_In_Tests_Has_Changed( // Arrange var options = new StrykerOptions() { - WithBaseline = true, + BaselineEnabled = true, ProjectVersion = "version" }; diff --git a/src/Stryker.Core/Stryker.Core.UnitTest/Options/Inputs/FallbackVersionInputTests.cs b/src/Stryker.Core/Stryker.Core.UnitTest/Options/Inputs/FallbackVersionInputTests.cs index c49c72d4e7..5ac3cbdfe1 100644 --- a/src/Stryker.Core/Stryker.Core.UnitTest/Options/Inputs/FallbackVersionInputTests.cs +++ b/src/Stryker.Core/Stryker.Core.UnitTest/Options/Inputs/FallbackVersionInputTests.cs @@ -22,7 +22,7 @@ public void ShouldNotValidate_IfNotEnabled() { var input = new FallbackVersionInput { SuppliedInput = "master" }; - var validatedInput = input.Validate(withBaseline: false, projectVersion: "master", sinceTarget: "master"); + var validatedInput = input.Validate(baselineEnabled: false, sinceTarget: "master"); validatedInput.ShouldBe(new SinceTargetInput().Default); } @@ -32,7 +32,7 @@ public void ShouldUseProvidedInputValue() { var input = new FallbackVersionInput { SuppliedInput = "development" }; - var validatedInput = input.Validate(withBaseline: true, projectVersion: "feat/feat4", sinceTarget: "master"); + var validatedInput = input.Validate(baselineEnabled: true, sinceTarget: "master"); validatedInput.ShouldBe("development"); } @@ -42,7 +42,7 @@ public void ShouldUseSinceTarget_IfNotExplicitlySet() { var input = new FallbackVersionInput(); - var validatedInput = input.Validate(withBaseline: true, projectVersion: "development", sinceTarget: "main"); + var validatedInput = input.Validate(baselineEnabled: true, sinceTarget: "main"); validatedInput.ShouldBe("main"); } diff --git a/src/Stryker.Core/Stryker.Core.UnitTest/Options/Inputs/ProjectVersionInputTests.cs b/src/Stryker.Core/Stryker.Core.UnitTest/Options/Inputs/ProjectVersionInputTests.cs index 01ed0de5d2..69871cdb0e 100644 --- a/src/Stryker.Core/Stryker.Core.UnitTest/Options/Inputs/ProjectVersionInputTests.cs +++ b/src/Stryker.Core/Stryker.Core.UnitTest/Options/Inputs/ProjectVersionInputTests.cs @@ -22,7 +22,7 @@ public void ProjectVersion_UsesSuppliedInput_IfDashboardReporterEnabled() var suppliedInput = "test"; var input = new ProjectVersionInput { SuppliedInput = suppliedInput }; - var result = input.Validate(reporters: new[] { Reporter.Dashboard }, withBaseline: false); + var result = input.Validate(reporters: new[] { Reporter.Dashboard }, baselineEnabled: false); result.ShouldBe(suppliedInput); } @@ -32,7 +32,7 @@ public void ProjectVersion_UsesSuppliedInput_IfBaselineEnabled() var suppliedInput = "test"; var input = new ProjectVersionInput { SuppliedInput = suppliedInput }; - var result = input.Validate(reporters: Enumerable.Empty(), withBaseline: true); + var result = input.Validate(reporters: Enumerable.Empty(), baselineEnabled: true); result.ShouldBe(suppliedInput); } @@ -42,7 +42,7 @@ public void ProjectVersion_ShouldBeDefault_IfBaselineAndDashboardDisabled() var suppliedInput = "test"; var input = new ProjectVersionInput { SuppliedInput = suppliedInput }; - var result = input.Validate(reporters: Enumerable.Empty(), withBaseline: false); + var result = input.Validate(reporters: Enumerable.Empty(), baselineEnabled: false); result.ShouldBe(string.Empty); } @@ -51,7 +51,7 @@ public void ProjectVersion_ShouldBeDefault_IfDashboardEnabledAndSuppliedInputNul { var input = new ProjectVersionInput(); - var result = input.Validate(reporters: new[] { Reporter.Dashboard }, withBaseline: false); + var result = input.Validate(reporters: new[] { Reporter.Dashboard }, baselineEnabled: false); result.ShouldBe(string.Empty); } @@ -61,7 +61,7 @@ public void ProjectVersion_CannotBeEmpty_WhenBaselineEnabled() var input = new ProjectVersionInput(); var exception = Should.Throw(() => { - input.Validate(reporters: Enumerable.Empty(), withBaseline: true); + input.Validate(reporters: Enumerable.Empty(), baselineEnabled: true); }); exception.Message.ShouldBe("Project version cannot be empty when baseline is enabled"); diff --git a/src/Stryker.Core/Stryker.Core.UnitTest/Options/Inputs/ReportersInputTests.cs b/src/Stryker.Core/Stryker.Core.UnitTest/Options/Inputs/ReportersInputTests.cs index bd4cd8db8d..c51b576e43 100644 --- a/src/Stryker.Core/Stryker.Core.UnitTest/Options/Inputs/ReportersInputTests.cs +++ b/src/Stryker.Core/Stryker.Core.UnitTest/Options/Inputs/ReportersInputTests.cs @@ -80,7 +80,7 @@ public void ShouldEnableBaselineReporterWhenWithBaselineEnabled() { var target = new ReportersInput { SuppliedInput = null }; - var validatedReporters = target.Validate(withBaseline: true); + var validatedReporters = target.Validate(baselineEnabled: true); validatedReporters.ShouldContain(Reporter.Baseline); } diff --git a/src/Stryker.Core/Stryker.Core.UnitTest/Options/Inputs/SinceInputTests.cs b/src/Stryker.Core/Stryker.Core.UnitTest/Options/Inputs/SinceInputTests.cs index 41ce619db3..a42e81e6c0 100644 --- a/src/Stryker.Core/Stryker.Core.UnitTest/Options/Inputs/SinceInputTests.cs +++ b/src/Stryker.Core/Stryker.Core.UnitTest/Options/Inputs/SinceInputTests.cs @@ -19,7 +19,7 @@ public void ShouldBeEnabledWhenTrue() { var target = new SinceInput { SuppliedInput = true }; - var result = target.Validate(withBaseline: null); + var result = target.Validate(baselineEnabled: null); result.ShouldBeTrue(); } @@ -29,7 +29,7 @@ public void ShouldBeEnabledWhenTrueEvenIfWithBaselineFalse() { var target = new SinceInput { SuppliedInput = true }; - var result = target.Validate(withBaseline: false); + var result = target.Validate(baselineEnabled: false); result.ShouldBeTrue(); } @@ -39,7 +39,7 @@ public void ShouldProvideDefaultWhenNull() { var target = new SinceInput(); - var result = target.Validate(withBaseline: null); + var result = target.Validate(baselineEnabled: null); result.ShouldBe(target.Default.Value); } @@ -49,7 +49,7 @@ public void ShouldNotBeEnabledWhenFalse() { var target = new SinceInput { SuppliedInput = false }; - var result = target.Validate(withBaseline: null); + var result = target.Validate(baselineEnabled: null); result.ShouldBeFalse(); } @@ -57,7 +57,7 @@ public void ShouldNotBeEnabledWhenFalse() [Fact] public void ShouldBeImplicitlyEnabledWithBaseline() { - var sinceEnabled = new SinceInput().Validate(withBaseline: true); + var sinceEnabled = new SinceInput().Validate(baselineEnabled: true); sinceEnabled.ShouldBeTrue(); } @@ -67,7 +67,7 @@ public void ShouldNotBeAllowedToExplicitlyEnableWithBaseline() { var sinceEnabled = new SinceInput{SuppliedInput = true }; - var exception = Should.Throw(() => sinceEnabled.Validate(withBaseline: true)); + var exception = Should.Throw(() => sinceEnabled.Validate(baselineEnabled: true)); exception.Message.ShouldBe("The since and baseline features are mutually exclusive."); } } diff --git a/src/Stryker.Core/Stryker.Core.UnitTest/Options/Inputs/WithBaselineInputTests.cs b/src/Stryker.Core/Stryker.Core.UnitTest/Options/Inputs/WithBaselineInputTests.cs index 174c345e22..f3352a28ca 100644 --- a/src/Stryker.Core/Stryker.Core.UnitTest/Options/Inputs/WithBaselineInputTests.cs +++ b/src/Stryker.Core/Stryker.Core.UnitTest/Options/Inputs/WithBaselineInputTests.cs @@ -4,19 +4,19 @@ namespace Stryker.Core.UnitTest.Options.Inputs { - public class WithBaselineInputTests : TestBase + public class BaselineEnabledInputTests : TestBase { [Fact] public void ShouldHaveHelpText() { - var target = new WithBaselineInput(); + var target = new BaselineEnabledInput(); target.HelpText.ShouldBe(@"EXPERIMENTAL: Use results stored in stryker dashboard to only test new mutants. | default: 'False'"); } [Fact] public void ShouldBeEnabledWhenTrue() { - var target = new WithBaselineInput { SuppliedInput = true }; + var target = new BaselineEnabledInput { SuppliedInput = true }; var result = target.Validate(); @@ -26,7 +26,7 @@ public void ShouldBeEnabledWhenTrue() [Fact] public void ShouldProvideDefaultFalseWhenNull() { - var target = new WithBaselineInput { SuppliedInput = null }; + var target = new BaselineEnabledInput { SuppliedInput = null }; var result = target.Validate(); @@ -36,7 +36,7 @@ public void ShouldProvideDefaultFalseWhenNull() [Fact] public void ShouldNotBeEnabledWhenFalse() { - var target = new WithBaselineInput { SuppliedInput = false }; + var target = new BaselineEnabledInput { SuppliedInput = false }; var result = target.Validate(); diff --git a/src/Stryker.Core/Stryker.Core.UnitTest/Options/StrykerInputsTests.cs b/src/Stryker.Core/Stryker.Core.UnitTest/Options/StrykerInputsTests.cs index 77c42f627d..d1f9bdc112 100644 --- a/src/Stryker.Core/Stryker.Core.UnitTest/Options/StrykerInputsTests.cs +++ b/src/Stryker.Core/Stryker.Core.UnitTest/Options/StrykerInputsTests.cs @@ -47,7 +47,7 @@ public class StrykerInputsTests : TestBase ThresholdBreakInput = new ThresholdBreakInput(), ThresholdHighInput = new ThresholdHighInput(), ThresholdLowInput = new ThresholdLowInput(), - WithBaselineInput = new WithBaselineInput(), + BaselineEnabledInput = new BaselineEnabledInput(), BreakOnInitialTestFailureInput = new BreakOnInitialTestFailureInput(), }; @@ -131,7 +131,7 @@ public void UsingDashboardBaselineStorageWithBaselineShouldEnableDashboardApiKey _target.DashboardApiKeyInput.SuppliedInput = "dashboard_api_key"; _target.ReportersInput.SuppliedInput = new[] { "html" }; _target.BaselineProviderInput.SuppliedInput = "dashboard"; - _target.WithBaselineInput.SuppliedInput = true; + _target.BaselineEnabledInput.SuppliedInput = true; _target.ProjectVersionInput.SuppliedInput = "develop"; var result = _target.ValidateAll(); @@ -145,7 +145,7 @@ public void NotUsingDashboardBaselineStorageWithBaselineOrDashboardReporterShoul _target.DashboardApiKeyInput.SuppliedInput = "dashboard_api_key"; _target.ReportersInput.SuppliedInput = new[] { "html" }; _target.BaselineProviderInput.SuppliedInput = "disk"; - _target.WithBaselineInput.SuppliedInput = true; + _target.BaselineEnabledInput.SuppliedInput = true; _target.ProjectVersionInput.SuppliedInput = "develop"; var result = _target.ValidateAll(); @@ -156,7 +156,7 @@ public void NotUsingDashboardBaselineStorageWithBaselineOrDashboardReporterShoul [Fact] public void WithBaselineAndSinceShouldBeMutuallyExclusive() { - _target.WithBaselineInput.SuppliedInput = true; + _target.BaselineEnabledInput.SuppliedInput = true; _target.SinceInput.SuppliedInput = true; var exception = Should.Throw(() => _target.ValidateAll()); @@ -167,7 +167,7 @@ public void WithBaselineAndSinceShouldBeMutuallyExclusive() public void WithBaselineShouldNotThrow_2743() // https://github.com/stryker-mutator/stryker-net/issues/2743 { _target.ProjectVersionInput.SuppliedInput = "1"; - _target.WithBaselineInput.SuppliedInput = true; + _target.BaselineEnabledInput.SuppliedInput = true; Should.NotThrow(() => _target.ValidateAll()); } @@ -175,14 +175,14 @@ public void WithBaselineShouldNotThrow_2743() // https://github.com/stryker-muta [Fact] public void BaseLineOptionsShouldBeSetToDefaultWhenBaselineIsDisabled() { - _target.WithBaselineInput.SuppliedInput = false; + _target.BaselineEnabledInput.SuppliedInput = false; _target.BaselineProviderInput.SuppliedInput = "azurefilestorage"; _target.AzureFileStorageSasInput.SuppliedInput = "sasCredential"; _target.AzureFileStorageUrlInput.SuppliedInput = "azureUrl"; var result = _target.ValidateAll(); - result.WithBaseline.ShouldBeFalse(); + result.BaselineEnabled.ShouldBeFalse(); result.BaselineProvider.ShouldBe(BaselineProvider.Disk); result.AzureFileStorageSas.ShouldBe(string.Empty); result.AzureFileStorageUrl.ShouldBe(string.Empty); diff --git a/src/Stryker.Core/Stryker.Core.UnitTest/Reporters/BaselineReporterTests.cs b/src/Stryker.Core/Stryker.Core.UnitTest/Reporters/BaselineReporterTests.cs index ef41534666..271d3f126e 100644 --- a/src/Stryker.Core/Stryker.Core.UnitTest/Reporters/BaselineReporterTests.cs +++ b/src/Stryker.Core/Stryker.Core.UnitTest/Reporters/BaselineReporterTests.cs @@ -24,7 +24,7 @@ public void Doesnt_Use_ProjectVersion_When_CurrentBranch_Is_Not_Null() { ProjectVersion = "new-feature", SinceTarget = "master", - WithBaseline = true + BaselineEnabled = true }; gitInfoProvider.Setup(x => x.GetCurrentBranchName()).Returns("new-feature"); diff --git a/src/Stryker.Core/Stryker.Core/Initialisation/ProjectOrchestrator.cs b/src/Stryker.Core/Stryker.Core/Initialisation/ProjectOrchestrator.cs index 1adcbf722e..bf0503715c 100644 --- a/src/Stryker.Core/Stryker.Core/Initialisation/ProjectOrchestrator.cs +++ b/src/Stryker.Core/Stryker.Core/Initialisation/ProjectOrchestrator.cs @@ -72,7 +72,7 @@ public IEnumerable MutateProjects(StrykerOptions options, private void InitializeDashboardProjectInformation(StrykerOptions options, SourceProjectInfo projectInfo) { var dashboardReporterEnabled = options.Reporters.Contains(Reporter.Dashboard) || options.Reporters.Contains(Reporter.All); - var dashboardBaselineEnabled = options.WithBaseline && options.BaselineProvider == BaselineProvider.Dashboard; + var dashboardBaselineEnabled = options.BaselineEnabled && options.BaselineProvider == BaselineProvider.Dashboard; var requiresProjectInformation = dashboardReporterEnabled || dashboardBaselineEnabled; var missingProjectName = string.IsNullOrEmpty(options.ProjectName); var missingProjectVersion = string.IsNullOrEmpty(options.ProjectVersion); diff --git a/src/Stryker.Core/Stryker.Core/MutantFilters/BaselineMutantFilter.cs b/src/Stryker.Core/Stryker.Core/MutantFilters/BaselineMutantFilter.cs index 38b424c79e..14d7404676 100644 --- a/src/Stryker.Core/Stryker.Core/MutantFilters/BaselineMutantFilter.cs +++ b/src/Stryker.Core/Stryker.Core/MutantFilters/BaselineMutantFilter.cs @@ -37,7 +37,7 @@ public BaselineMutantFilter(StrykerOptions options, IBaselineProvider baselinePr _options = options; - if (options.WithBaseline) + if (options.BaselineEnabled) { _baseline = GetBaselineAsync().Result; } @@ -46,7 +46,7 @@ public BaselineMutantFilter(StrykerOptions options, IBaselineProvider baselinePr public IEnumerable FilterMutants(IEnumerable mutants, IReadOnlyFileLeaf file, StrykerOptions options) { - if (options.WithBaseline) + if (options.BaselineEnabled) { if (_baseline == null) { diff --git a/src/Stryker.Core/Stryker.Core/MutantFilters/MutantFilterFactory.cs b/src/Stryker.Core/Stryker.Core/MutantFilters/MutantFilterFactory.cs index 11cf27a452..944730552e 100644 --- a/src/Stryker.Core/Stryker.Core/MutantFilters/MutantFilterFactory.cs +++ b/src/Stryker.Core/Stryker.Core/MutantFilters/MutantFilterFactory.cs @@ -42,12 +42,12 @@ private static IEnumerable DetermineEnabledMutantFilters(StrykerO new IgnoreBlockMutantFilter(), }; - if (options.WithBaseline) + if (options.BaselineEnabled) { enabledFilters.Add(new BaselineMutantFilter(options, _baselineProvider ?? BaselineProviderFactory.Create(options), _gitInfoProvider ?? new GitInfoProvider(options))); } - if (options.Since || options.WithBaseline) + if (options.Since || options.BaselineEnabled) { enabledFilters.Add(new SinceMutantFilter(_diffProvider ?? new GitDiffProvider(options, _input.TestRunner.GetTests(_input.SourceProjectInfo)))); } diff --git a/src/Stryker.Core/Stryker.Core/Options/Inputs/AzureFileStorageSasInput.cs b/src/Stryker.Core/Stryker.Core/Options/Inputs/AzureFileStorageSasInput.cs index d91a8f699b..4e1be15f15 100644 --- a/src/Stryker.Core/Stryker.Core/Options/Inputs/AzureFileStorageSasInput.cs +++ b/src/Stryker.Core/Stryker.Core/Options/Inputs/AzureFileStorageSasInput.cs @@ -11,9 +11,9 @@ public class AzureFileStorageSasInput : Input public override string Default => string.Empty; - public string Validate(BaselineProvider baselineProvider, bool withBaseline) + public string Validate(BaselineProvider baselineProvider, bool baselineEnabled) { - if (withBaseline && baselineProvider == BaselineProvider.AzureFileStorage) + if (baselineEnabled && baselineProvider == BaselineProvider.AzureFileStorage) { if (string.IsNullOrWhiteSpace(SuppliedInput)) { diff --git a/src/Stryker.Core/Stryker.Core/Options/Inputs/AzureFileStorageUrlInput.cs b/src/Stryker.Core/Stryker.Core/Options/Inputs/AzureFileStorageUrlInput.cs index cce0417620..c68cae6216 100644 --- a/src/Stryker.Core/Stryker.Core/Options/Inputs/AzureFileStorageUrlInput.cs +++ b/src/Stryker.Core/Stryker.Core/Options/Inputs/AzureFileStorageUrlInput.cs @@ -13,9 +13,9 @@ public class AzureFileStorageUrlInput : Input public override string Default => string.Empty; - public string Validate(BaselineProvider baselineProvider, bool withBaseline) + public string Validate(BaselineProvider baselineProvider, bool baselineEnabled) { - if (withBaseline && baselineProvider == BaselineProvider.AzureFileStorage) + if (baselineEnabled && baselineProvider == BaselineProvider.AzureFileStorage) { if (SuppliedInput is null) { diff --git a/src/Stryker.Core/Stryker.Core/Options/Inputs/BaselineProviderInput.cs b/src/Stryker.Core/Stryker.Core/Options/Inputs/BaselineProviderInput.cs index 7d7171e563..ce4459c77c 100644 --- a/src/Stryker.Core/Stryker.Core/Options/Inputs/BaselineProviderInput.cs +++ b/src/Stryker.Core/Stryker.Core/Options/Inputs/BaselineProviderInput.cs @@ -14,9 +14,9 @@ public class BaselineProviderInput : Input protected override IEnumerable AllowedOptions => EnumToStrings(typeof(BaselineProvider)); - public BaselineProvider Validate(IEnumerable reporters, bool withBaseline) + public BaselineProvider Validate(IEnumerable reporters, bool baselineEnabled) { - if (withBaseline) + if (baselineEnabled) { if (SuppliedInput is not null) { diff --git a/src/Stryker.Core/Stryker.Core/Options/Inputs/DashboardApiKeyInput.cs b/src/Stryker.Core/Stryker.Core/Options/Inputs/DashboardApiKeyInput.cs index 8923a47d32..87dec97f34 100644 --- a/src/Stryker.Core/Stryker.Core/Options/Inputs/DashboardApiKeyInput.cs +++ b/src/Stryker.Core/Stryker.Core/Options/Inputs/DashboardApiKeyInput.cs @@ -13,13 +13,13 @@ public class DashboardApiKeyInput : Input public override string Default => null; - public string Validate(bool? withBaseline, BaselineProvider baselineProvider, IEnumerable reporters) + public string Validate(bool? baselineEnabled, BaselineProvider baselineProvider, IEnumerable reporters) { /* the dashboard api key is required if * 1: The dashboard reporter is enabled * 2: The dasboard storage location is chosen for the with-baseline feature AND the with-baseline feature is enabled */ - var dashboardEnabled = (withBaseline.IsNotNullAndTrue() && baselineProvider == BaselineProvider.Dashboard) || reporters.Any(x => x is Reporter.Dashboard or Reporter.RealTimeDashboard); + var dashboardEnabled = (baselineEnabled.IsNotNullAndTrue() && baselineProvider == BaselineProvider.Dashboard) || reporters.Any(x => x is Reporter.Dashboard or Reporter.RealTimeDashboard); if (!dashboardEnabled) { return Default; diff --git a/src/Stryker.Core/Stryker.Core/Options/Inputs/FallbackVersionInput.cs b/src/Stryker.Core/Stryker.Core/Options/Inputs/FallbackVersionInput.cs index f4710a2519..56671e9fca 100644 --- a/src/Stryker.Core/Stryker.Core/Options/Inputs/FallbackVersionInput.cs +++ b/src/Stryker.Core/Stryker.Core/Options/Inputs/FallbackVersionInput.cs @@ -11,9 +11,9 @@ When you don't specify a fallback version the since target will be used as fallb public override string Default => new SinceTargetInput().Default; - public string Validate(bool withBaseline, string projectVersion, string sinceTarget) + public string Validate(bool baselineEnabled, string sinceTarget) { - if (withBaseline) + if (baselineEnabled) { if(SuppliedInput is null) { diff --git a/src/Stryker.Core/Stryker.Core/Options/Inputs/ProjectVersionInput.cs b/src/Stryker.Core/Stryker.Core/Options/Inputs/ProjectVersionInput.cs index 166ff79369..57f47edec9 100644 --- a/src/Stryker.Core/Stryker.Core/Options/Inputs/ProjectVersionInput.cs +++ b/src/Stryker.Core/Stryker.Core/Options/Inputs/ProjectVersionInput.cs @@ -11,11 +11,11 @@ public class ProjectVersionInput : Input protected override string Description => "Project version used in dashboard reporter and baseline feature."; - public string Validate(IEnumerable reporters, bool withBaseline) + public string Validate(IEnumerable reporters, bool baselineEnabled) { - if (reporters.Contains(Reporter.Dashboard) || reporters.Contains(Reporter.RealTimeDashboard) || withBaseline) + if (reporters.Contains(Reporter.Dashboard) || reporters.Contains(Reporter.RealTimeDashboard) || baselineEnabled) { - if (withBaseline && string.IsNullOrWhiteSpace(SuppliedInput)) + if (baselineEnabled && string.IsNullOrWhiteSpace(SuppliedInput)) { throw new InputException("Project version cannot be empty when baseline is enabled"); } diff --git a/src/Stryker.Core/Stryker.Core/Options/Inputs/ReportersInput.cs b/src/Stryker.Core/Stryker.Core/Options/Inputs/ReportersInput.cs index ab5cfcf548..3ebcf9bf06 100644 --- a/src/Stryker.Core/Stryker.Core/Options/Inputs/ReportersInput.cs +++ b/src/Stryker.Core/Stryker.Core/Options/Inputs/ReportersInput.cs @@ -13,7 +13,7 @@ public class ReportersInput : Input> protected override string Description => "Reporters inform about various stages in the mutation testrun."; protected override IEnumerable AllowedOptions => EnumToStrings(typeof(Reporter)); - public IEnumerable Validate(bool withBaseline) + public IEnumerable Validate(bool baselineEnabled) { HashSet reporters; if (SuppliedInput is not null) @@ -27,7 +27,7 @@ public IEnumerable Validate(bool withBaseline) reporters = new HashSet { Reporter.Progress, Reporter.Html }; } - if(withBaseline) + if(baselineEnabled) { reporters.Add(Reporter.Baseline); } diff --git a/src/Stryker.Core/Stryker.Core/Options/Inputs/SinceInput.cs b/src/Stryker.Core/Stryker.Core/Options/Inputs/SinceInput.cs index b471bd828f..2f02e2c66f 100644 --- a/src/Stryker.Core/Stryker.Core/Options/Inputs/SinceInput.cs +++ b/src/Stryker.Core/Stryker.Core/Options/Inputs/SinceInput.cs @@ -8,9 +8,9 @@ public class SinceInput : Input protected override string Description => "Enables diff compare. Only test changed files."; - public bool Validate(bool? withBaseline) + public bool Validate(bool? baselineEnabled) { - if (withBaseline.IsNotNullAndTrue()) + if (baselineEnabled.IsNotNullAndTrue()) { if (SuppliedInput.HasValue && SuppliedInput.Value) { diff --git a/src/Stryker.Core/Stryker.Core/Options/Inputs/WithBaselineInput.cs b/src/Stryker.Core/Stryker.Core/Options/Inputs/WithBaselineInput.cs index 215c1a0148..6f7552e81a 100644 --- a/src/Stryker.Core/Stryker.Core/Options/Inputs/WithBaselineInput.cs +++ b/src/Stryker.Core/Stryker.Core/Options/Inputs/WithBaselineInput.cs @@ -1,12 +1,12 @@ namespace Stryker.Core.Options.Inputs { - public class WithBaselineInput : Input + public class BaselineEnabledInput : Input { public override bool? Default => false; protected override string Description => "EXPERIMENTAL: Use results stored in stryker dashboard to only test new mutants."; - public WithBaselineInput() { } + public BaselineEnabledInput() { } public bool Validate() { diff --git a/src/Stryker.Core/Stryker.Core/Options/StrykerInputs.cs b/src/Stryker.Core/Stryker.Core/Options/StrykerInputs.cs index d785ed6cbd..ae1e02f41c 100644 --- a/src/Stryker.Core/Stryker.Core/Options/StrykerInputs.cs +++ b/src/Stryker.Core/Stryker.Core/Options/StrykerInputs.cs @@ -45,7 +45,7 @@ public interface IStrykerInputs ThresholdHighInput ThresholdHighInput { get; init; } ThresholdLowInput ThresholdLowInput { get; init; } VerbosityInput VerbosityInput { get; init; } - WithBaselineInput WithBaselineInput { get; init; } + BaselineEnabledInput BaselineEnabledInput { get; init; } OpenReportInput OpenReportInput { get; init; } OpenReportEnabledInput OpenReportEnabledInput { get; init; } BreakOnInitialTestFailureInput BreakOnInitialTestFailureInput { get; init; } @@ -84,7 +84,7 @@ public StrykerInputs(IFileSystem fileSystem = null) public TestCaseFilterInput TestCaseFilterInput { get; init; } = new(); public ReportersInput ReportersInput { get; init; } = new(); public BaselineRecreateEnabledInput BaselineRecreateEnabledInput { get; init; } = new(); - public WithBaselineInput WithBaselineInput { get; init; } = new(); + public BaselineEnabledInput BaselineEnabledInput { get; init; } = new(); public BaselineProviderInput BaselineProviderInput { get; init; } = new(); public AzureFileStorageUrlInput AzureFileStorageUrlInput { get; init; } = new(); public AzureFileStorageSasInput AzureFileStorageSasInput { get; init; } = new(); @@ -114,13 +114,13 @@ public StrykerOptions ValidateAll() var basePath = BasePathInput.Validate(_fileSystem); var outputPath = OutputPathInput.Validate(_fileSystem); var reportFileNameInput = ReportFileNameInput.Validate(); - var baselineCreateEnabled = BaselineRecreateEnabledInput.Validate(); - var withBaseline = WithBaselineInput.Validate(); - var reporters = ReportersInput.Validate(withBaseline); - var baselineProvider = BaselineProviderInput.Validate(reporters, withBaseline); - var sinceEnabled = SinceInput.Validate(WithBaselineInput.SuppliedInput); + var baselineEnabled = BaselineEnabledInput.Validate(); + var baselineRecreateEnabled = BaselineRecreateEnabledInput.Validate(); + var reporters = ReportersInput.Validate(baselineEnabled); + var baselineProvider = BaselineProviderInput.Validate(reporters, baselineEnabled); + var sinceEnabled = SinceInput.Validate(BaselineEnabledInput.SuppliedInput); var sinceTarget = SinceTargetInput.Validate(sinceEnabled); - var projectVersion = ProjectVersionInput.Validate(reporters, withBaseline); + var projectVersion = ProjectVersionInput.Validate(reporters, baselineEnabled); _strykerOptionsCache ??= new StrykerOptions() { @@ -156,17 +156,17 @@ public StrykerOptions ValidateAll() TestProjects = TestProjectsInput.Validate(), TestCaseFilter = TestCaseFilterInput.Validate(), DashboardUrl = DashboardUrlInput.Validate(), - DashboardApiKey = DashboardApiKeyInput.Validate(withBaseline, baselineProvider, reporters), + DashboardApiKey = DashboardApiKeyInput.Validate(baselineEnabled, baselineProvider, reporters), ProjectName = ProjectNameInput.Validate(), ModuleName = ModuleNameInput.Validate(), - ProjectVersion = ProjectVersionInput.Validate(reporters, withBaseline), + ProjectVersion = ProjectVersionInput.Validate(reporters, baselineEnabled), DiffIgnoreChanges = DiffIgnoreChangesInput.Validate(), - AzureFileStorageSas = AzureFileStorageSasInput.Validate(baselineProvider, withBaseline), - AzureFileStorageUrl = AzureFileStorageUrlInput.Validate(baselineProvider, withBaseline), - BaselineRecreateEnabled = baselineCreateEnabled, - WithBaseline = withBaseline, + AzureFileStorageSas = AzureFileStorageSasInput.Validate(baselineProvider, baselineEnabled), + AzureFileStorageUrl = AzureFileStorageUrlInput.Validate(baselineProvider, baselineEnabled), + BaselineRecreateEnabled = baselineRecreateEnabled, + BaselineEnabled = baselineEnabled, BaselineProvider = baselineProvider, - FallbackVersion = FallbackVersionInput.Validate(withBaseline, projectVersion, sinceTarget), + FallbackVersion = FallbackVersionInput.Validate(baselineEnabled, sinceTarget), Since = sinceEnabled, SinceTarget = sinceTarget, ReportTypeToOpen = OpenReportInput.Validate(OpenReportEnabledInput.Validate()), diff --git a/src/Stryker.Core/Stryker.Core/Options/StrykerOptions.cs b/src/Stryker.Core/Stryker.Core/Options/StrykerOptions.cs index d6b43c42ba..003f9f2e13 100644 --- a/src/Stryker.Core/Stryker.Core/Options/StrykerOptions.cs +++ b/src/Stryker.Core/Stryker.Core/Options/StrykerOptions.cs @@ -116,7 +116,7 @@ public class StrykerOptions /// /// When true, the baseline feature should be enabled. /// - public bool WithBaseline { get; init; } + public bool BaselineEnabled { get; init; } /// /// When the baseline feature is enabled, this selects the source of the baseline. @@ -283,7 +283,7 @@ public string ProjectVersion TestProjects = testProjects, TestCaseFilter = TestCaseFilter, Thresholds = Thresholds, - WithBaseline = WithBaseline, + BaselineEnabled = BaselineEnabled, BreakOnInitialTestFailure = BreakOnInitialTestFailure, }; } From 0d62dda68140d1caff66f019012cc5950e94fd2f Mon Sep 17 00:00:00 2001 From: Richard Werkman Date: Fri, 16 Feb 2024 14:09:13 +0100 Subject: [PATCH 20/27] Update docs and add help text for commands --- docs/configuration.md | 37 +- .../Stryker.CLI.UnitTest/packages.lock.json | 6 +- .../CommandLineConfigReader.cs | 19 +- .../Stryker.CLI/packages.lock.json | 4 +- .../Stryker.Core.UnitTest/packages.lock.json | 6 +- .../Stryker.Core/packages.lock.json | 526 +++++++----------- .../packages.lock.json | 2 +- 7 files changed, 240 insertions(+), 360 deletions(-) diff --git a/docs/configuration.md b/docs/configuration.md index ecd501d7b4..2c76ffcb21 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -451,7 +451,7 @@ Config file: `"since": { }` Use git information to test only code changes since the given target. Stryker will only report on mutants within the changed code. All other mutants will not have a result. -If you wish to test only changed sources and tests but would like to have a complete mutation report see [with-baseline](#with-baseline-flag-committish). +If you wish to test only changed sources and tests but would like to have a complete mutation report see [with-baseline](#with-baseline-committish). Set the diffing target on the command line by passing a committish with the since flag in the format `--since:`. Set the diffing target in the config file by setting the [since target](#sincetarget-committish) option. @@ -491,33 +491,26 @@ Use [globbing syntax](https://en.wikipedia.org/wiki/Glob_(programming)) for wild ## Baseline -### `baseline` <`command`> +### `with-baseline` <`committish`> -Default: `false` -Command line: `dotnet stryker baseline` -Config file: `"baseline": { }` +Default: `false` +Command line: `with-baseline feat-2` +Config file: `"baseline": { }` -Enabling `with-baseline` saves the mutation report to a storage location such as the filesystem. The mutation report is loaded at the start of the next mutation run. Any changed source code or unit test results in a reset of the mutants affected by the change. For unchanged mutants the previous result is reused. This feature expands on the [since](#since-flag-committish) feature by providing you with a full report after a partial mutation testrun. +Enabling `baseline`, alias `with-baseline`, saves the mutation report to a storage location such as the filesystem. The mutation report is loaded at the start of the next mutation run. Any changed source code or unit test results in a reset of the mutants affected by the change. For unchanged mutants the previous result is reused. This feature expands on the [since](#since-flag-committish) feature by providing you with a full report after a partial mutation testrun. The target of the baseline is a `committish` passed as an extra argument. The target determines which committish is used to establish or locate a baseline. The report name is based on the current branch name or the [project-info.version](#project-infoversion-committish). -*\* The baseline and since features are mutually exclusive. This feature implicitly enables the [since](#since-flag-committish) feature for now.* - -### `target` <`string`> -Default: `false` -Command line: `dotnet stryker baseline --target feat-2` -Config file: `"baseline": { "target": "feat-2" }` - -Set the target on the command line by passing a committish with the baseline target option. +*\* The baseline and since features are mutually exclusive. This feature implicitly enables the [since](#since-flag-committish) feature for now.* ### `baseline.fallback-version` <`string`> -Default: [since-target](#since-flag-committish) -Command line: `N/A` -Config file: `"baseline": { "fallback-version": 'develop' }` +Default: [since-target](#since-flag-committish) +Command line: `N/A` +Config file: `"baseline": { "fallback-version": 'develop' }` -When [with-baseline](#with-baseline-flag-committish) is enabled and Stryker cannot find an existing report for the current branch the fallback version is used. When Stryker is still unable to find a baseline we will do a complete instead of partial testrun. The complete testrun will then be saved as the new baseline for the next mutation testrun. +When [with-baseline](#with-baseline-committish) is enabled and Stryker cannot find an existing report for the current branch the fallback version is used. When Stryker is still unable to find a baseline we will do a complete instead of partial testrun. The complete testrun will then be saved as the new baseline for the next mutation testrun. **Example**: ```json @@ -552,9 +545,9 @@ new baseline saved to: feat-2 Default: `Disk` Command line: `N/A` -Config file: `"baseline": { "provider": 'AzureFileStorage'}` +Config file: `"baseline": { "provider": 'AzureFileStorage'}` -Sets the storage provider for the baseline used by [with-baseline](#with-baseline-flag-committish). By default this is set to disk, when the dashboard [reporter](#reporter-string) is enabled this is automatically set to Dashboard. +Sets the storage provider for the baseline used by [with-baseline](#with-baseline-committish). By default this is set to disk, when the dashboard [reporter](#reporter-string) is enabled this is automatically set to Dashboard. Supported storage providers are: @@ -583,7 +576,7 @@ Providing a subfolder is optional but allowed. In the case of a custom subfolder ### `azure-fileshare-sas` <`string`> Default: `null` -Command line: `dotnet stryker baseline --azure-fileshare-sas "se=2022-08-25T14%3A27Z&sp=rwdl&spr=https&sv=2021-06-08&sr=d&sdd=1&sig=XXXXXXXXXXXXX"` +Command line: `--azure-fileshare-sas "se=2022-08-25T14%3A27Z&sp=rwdl&spr=https&sv=2021-06-08&sr=d&sdd=1&sig=XXXXXXXXXXXXX"` Config file: `N/A` When using the azure file storage [provider](#baselineprovider-string) you must pass credentials for the fileshare to Stryker. @@ -600,7 +593,7 @@ For more information on how to configure a SAS check the [Azure documentation](h ### `baseline recreate` Default: `false` -Command line: `dotnet stryker baseline recreate` +Command line: `baseline recreate main` Config file: `N/A` Sometimes your baseline can get corrupted or out of touch with reality. In that case the baseline can be recreated using this command. This will test all mutations in your project and save the result as the new baseline. diff --git a/src/Stryker.CLI/Stryker.CLI.UnitTest/packages.lock.json b/src/Stryker.CLI/Stryker.CLI.UnitTest/packages.lock.json index 47cf80e3a4..b98e9728e5 100644 --- a/src/Stryker.CLI/Stryker.CLI.UnitTest/packages.lock.json +++ b/src/Stryker.CLI/Stryker.CLI.UnitTest/packages.lock.json @@ -1644,8 +1644,8 @@ "ShellProgressBar": "[5.2.0, )", "Spectre.Console": "[0.48.0, )", "Spectre.Console.Analyzer": "[0.48.0, )", - "Stryker.DataCollector": "[3.13.2, )", - "Stryker.RegexMutators": "[3.13.2, )", + "Stryker.DataCollector": "[1.0.0, )", + "Stryker.RegexMutators": "[1.0.0, )", "TestableIO.System.IO.Abstractions.Wrappers": "[20.0.15, )" } }, @@ -1924,4 +1924,4 @@ } } } -} +} \ No newline at end of file diff --git a/src/Stryker.CLI/Stryker.CLI/CommandLineConfig/CommandLineConfigReader.cs b/src/Stryker.CLI/Stryker.CLI/CommandLineConfig/CommandLineConfigReader.cs index 8efa8f97e7..4109f4d959 100644 --- a/src/Stryker.CLI/Stryker.CLI/CommandLineConfig/CommandLineConfigReader.cs +++ b/src/Stryker.CLI/Stryker.CLI/CommandLineConfig/CommandLineConfigReader.cs @@ -34,6 +34,8 @@ public void RegisterInitCommand(CommandLineApplication app, IFileSystem fileSyst { RegisterCliInputs(initCommandApp); + initCommandApp.HelpOption(); + initCommandApp.OnExecute(() => { _console.WriteLine($"Initializing new config file."); @@ -72,10 +74,20 @@ public void RegisterBaselineCommand(CommandLineApplication app, IStrykerInputs i { app.Command("baseline", baselineCmd => { + baselineCmd.AddName("with-baseline"); RegisterCliInputs(baselineCmd); + var committish = baselineCmd.Argument("committish", "The committish to compare with the current HEAD. This can be a branch, tag or commit id."); + committish.IsRequired(true); + + baselineCmd.HelpOption(); + baselineCmd.OnExecute(() => { + if (committish.HasValue) + { + inputs.BaselineTargetInput.SuppliedInput = committish.Value; + } inputs.BaselineEnabledInput.SuppliedInput = true; baselineCmd.Description = "Starts a stryker run based on the results of a previous run."; return strykerCli.StartApp(inputs, args, app, this); @@ -85,8 +97,14 @@ public void RegisterBaselineCommand(CommandLineApplication app, IStrykerInputs i { RegisterCliInputs(createCmd); + createCmd.HelpOption(); + createCmd.OnExecute(() => { + if (committish.HasValue) + { + inputs.BaselineTargetInput.SuppliedInput = committish.Value; + } inputs.BaselineEnabledInput.SuppliedInput = true; createCmd.Description = "Creates a new baseline by doing a full stryker run"; // Enable recreate @@ -212,7 +230,6 @@ private void PrepareCliOptions(IStrykerInputs inputs) AddCliInput(inputs.MutationLevelInput, "mutation-level", "l", category: InputCategory.Mutation); AddCliInput(inputs.SinceInput, "since", "", optionType: CommandOptionType.SingleOrNoValue, argumentHint: "committish", category: InputCategory.Mutation); AddCliInput(inputs.BaselineEnabledInput, "with-baseline", "", optionType: CommandOptionType.SingleOrNoValue, argumentHint: "committish", category: InputCategory.Mutation); - AddCliInput(inputs.BaselineTargetInput, "target", "", argumentHint: "committish", category: InputCategory.Mutation); // Category: Reporting AddCliInput(inputs.OpenReportInput, "open-report", "o", CommandOptionType.SingleOrNoValue, argumentHint: "report-type", category: InputCategory.Reporting); AddCliInput(inputs.ReportersInput, "reporter", "r", optionType: CommandOptionType.MultipleValue, category: InputCategory.Reporting); diff --git a/src/Stryker.CLI/Stryker.CLI/packages.lock.json b/src/Stryker.CLI/Stryker.CLI/packages.lock.json index cbdad87af5..77039a37c4 100644 --- a/src/Stryker.CLI/Stryker.CLI/packages.lock.json +++ b/src/Stryker.CLI/Stryker.CLI/packages.lock.json @@ -1484,8 +1484,8 @@ "ShellProgressBar": "[5.2.0, )", "Spectre.Console": "[0.48.0, )", "Spectre.Console.Analyzer": "[0.48.0, )", - "Stryker.DataCollector": "[3.13.2, )", - "Stryker.RegexMutators": "[3.13.2, )", + "Stryker.DataCollector": "[1.0.0, )", + "Stryker.RegexMutators": "[1.0.0, )", "TestableIO.System.IO.Abstractions.Wrappers": "[20.0.15, )" } }, diff --git a/src/Stryker.Core/Stryker.Core.UnitTest/packages.lock.json b/src/Stryker.Core/Stryker.Core.UnitTest/packages.lock.json index a84cbd439b..534e4fc589 100644 --- a/src/Stryker.Core/Stryker.Core.UnitTest/packages.lock.json +++ b/src/Stryker.Core/Stryker.Core.UnitTest/packages.lock.json @@ -1611,8 +1611,8 @@ "ShellProgressBar": "[5.2.0, )", "Spectre.Console": "[0.48.0, )", "Spectre.Console.Analyzer": "[0.48.0, )", - "Stryker.DataCollector": "[3.13.2, )", - "Stryker.RegexMutators": "[3.13.2, )", + "Stryker.DataCollector": "[1.0.0, )", + "Stryker.RegexMutators": "[1.0.0, )", "TestableIO.System.IO.Abstractions.Wrappers": "[20.0.15, )" } }, @@ -1867,4 +1867,4 @@ } } } -} +} \ No newline at end of file diff --git a/src/Stryker.Core/Stryker.Core/packages.lock.json b/src/Stryker.Core/Stryker.Core/packages.lock.json index 39dd545f0d..3d64034b01 100644 --- a/src/Stryker.Core/Stryker.Core/packages.lock.json +++ b/src/Stryker.Core/Stryker.Core/packages.lock.json @@ -2,24 +2,28 @@ "version": 2, "dependencies": { "net6.0": { + "Azure.Storage.Files.Shares": { + "type": "Direct", + "requested": "[12.17.1, )", + "resolved": "12.17.1", + "contentHash": "DL1L3e4uwxYsBVtxncAJYve+q6/iA/k/TjBCmT2nVCdff4d58PGNkmWUKAnESpVj5OZdV6n3bHAJdx1P8eCwuQ==", + "dependencies": { + "Azure.Storage.Common": "12.18.1", + "System.Text.Json": "4.7.2" + } + }, "Buildalyzer": { "type": "Direct", - "requested": "[5.0.1, )", - "resolved": "5.0.1", - "contentHash": "q42QUS/g1O3WKNxHPgriAA5i1NbpU30TcTB5oxACgZLo1HF6zxy66OUj2ORaAYC9bQRKXd8J56i2L0vE9lMVTA==", - "dependencies": { - "Buildalyzer.Logger": "5.0.1", - "MSBuild.StructuredLogger": "2.1.507", - "Microsoft.Build": "16.9.0", - "Microsoft.Build.Framework": "16.9.0", - "Microsoft.Build.Tasks.Core": "16.9.0", - "Microsoft.Build.Utilities.Core": "16.9.0", - "Microsoft.Extensions.DependencyModel": "2.1.0", - "Microsoft.Extensions.Logging": "2.1.1", - "Microsoft.Extensions.Logging.Abstractions": "2.1.1", - "MsBuildPipeLogger.Server": "1.1.6", - "NuGet.Frameworks": "6.0.0", - "System.Reflection.TypeExtensions": "4.7.0" + "requested": "[6.0.4, )", + "resolved": "6.0.4", + "contentHash": "3LMYgCWiBvOfmPFUMl7pqbjo/VOK7Ma+pHQCkbAMZ6PU914iT3zSCheqURBiyRCHUJhinYzqlwGhO2HPyWQkGw==", + "dependencies": { + "Buildalyzer.Logger": "6.0.4", + "MSBuild.StructuredLogger": "2.1.815", + "Microsoft.Build": "17.0.1", + "Microsoft.Build.Tasks.Core": "17.0.1", + "Microsoft.Extensions.Logging": "6.0.0", + "MsBuildPipeLogger.Server": "1.1.6" } }, "DotNet.Glob": { @@ -42,21 +46,21 @@ }, "FSharp.Compiler.Service": { "type": "Direct", - "requested": "[41.0.7, )", - "resolved": "41.0.7", - "contentHash": "9hnZKKutBr96xpu16gbdo8RTdPhjTG8FTtH8p/DPhVOoEoELBEl1bZiodiqdDLP+XDXHstZJo398XCVk7ohp+w==", - "dependencies": { - "FSharp.Core": "[6.0.7]", - "Microsoft.Build.Framework": "17.0.0", - "Microsoft.Build.Tasks.Core": "17.0.0", - "Microsoft.Build.Utilities.Core": "17.0.0", + "requested": "[42.7.100-preview.22427.1, )", + "resolved": "42.7.100-preview.22427.1", + "contentHash": "YFUc1NLxo/RI1LbJVxpa/bgsHTGsvLWakJkDeoR5CnBdgw6jDte9TElrWy7SKr2q5YLjuUFWtQ42TgEVn1hScw==", + "dependencies": { + "FSharp.Core": "[7.0.0-beta.22427.1]", + "Microsoft.Build.Framework": "17.1.0", + "Microsoft.Build.Tasks.Core": "17.1.0", + "Microsoft.Build.Utilities.Core": "17.1.0", "System.Buffers": "4.5.1", "System.Collections.Immutable": "5.0.0", "System.Diagnostics.Process": "4.3.0", "System.Diagnostics.TraceSource": "4.3.0", "System.Linq.Expressions": "4.3.0", "System.Linq.Queryable": "4.3.0", - "System.Memory": "4.5.4", + "System.Memory": "4.5.5", "System.Net.Requests": "4.3.0", "System.Net.Security": "4.3.1", "System.Reflection.Emit": "4.3.0", @@ -82,61 +86,59 @@ }, "LibGit2Sharp": { "type": "Direct", - "requested": "[0.27.2, )", - "resolved": "0.27.2", - "contentHash": "TYIfwuumwmZFjxwRFz5y2MyTA8jc19MejSyRRTCS/TflhrdQPH7H84ueyCpY0+xkNWThEd+dCnkuf7XuH3tt+A==", + "requested": "[0.29.0, )", + "resolved": "0.29.0", + "contentHash": "dVDXYqhNV62/aTi7fJaa1PkpIE0uUqlrZzLbM5yUrI6o8siCZIFlZv79sf2VYaFyluiduLpADD92on4AcVHvAA==", "dependencies": { - "LibGit2Sharp.NativeBinaries": "[2.0.320]" + "LibGit2Sharp.NativeBinaries": "[2.0.321]" } }, "Microsoft.CodeAnalysis.CSharp": { "type": "Direct", - "requested": "[4.7.0, )", - "resolved": "4.7.0", - "contentHash": "JHCP2L6lB0oJ3tQoHkC67SFZxW+KbJVOnAo+6L01K5r/NlBlSUhTk5nUAldWhTVwGdzqNeHqGtnEqpsCmGSwQA==", + "requested": "[4.8.0, )", + "resolved": "4.8.0", + "contentHash": "+3+qfdb/aaGD8PZRCrsdobbzGs1m9u119SkkJt8e/mk3xLJz/udLtS2T6nY27OTXxBBw10HzAbC8Z9w08VyP/g==", "dependencies": { - "Microsoft.CodeAnalysis.Common": "[4.7.0]" + "Microsoft.CodeAnalysis.Common": "[4.8.0]" } }, "Microsoft.Extensions.Logging": { "type": "Direct", - "requested": "[7.0.0, )", - "resolved": "7.0.0", - "contentHash": "Nw2muoNrOG5U5qa2ZekXwudUn2BJcD41e65zwmDHb1fQegTX66UokLWZkJRpqSSHXDOWZ5V0iqhbxOEky91atA==", + "requested": "[8.0.0, )", + "resolved": "8.0.0", + "contentHash": "tvRkov9tAJ3xP51LCv3FJ2zINmv1P8Hi8lhhtcKGqM+ImiTCC84uOPEI4z8Cdq2C3o9e+Aa0Gw0rmrsJD77W+w==", "dependencies": { - "Microsoft.Extensions.DependencyInjection": "7.0.0", - "Microsoft.Extensions.DependencyInjection.Abstractions": "7.0.0", - "Microsoft.Extensions.Logging.Abstractions": "7.0.0", - "Microsoft.Extensions.Options": "7.0.0" + "Microsoft.Extensions.DependencyInjection": "8.0.0", + "Microsoft.Extensions.Logging.Abstractions": "8.0.0", + "Microsoft.Extensions.Options": "8.0.0" } }, "Microsoft.TestPlatform": { "type": "Direct", - "requested": "[17.7.2, )", - "resolved": "17.7.2", - "contentHash": "PYDJBWm8NF+U/K1VaXXTbkC0r5RGsuEzGhtM9SOqtl1BTf+av5gLmDOqm3oMpfuYzqANu3rLpvLeSKccRDc2vA==" + "requested": "[17.9.0, )", + "resolved": "17.9.0", + "contentHash": "lqPzfM6C5eIXLtp1TvLf329jBFkRrtatfvdxb79S6+t2X2XQVJxyigpoV4g3rBkqn1AGbLOa6/fGV0ef4CoHJQ==" }, "Microsoft.TestPlatform.ObjectModel": { "type": "Direct", - "requested": "[17.7.2, )", - "resolved": "17.7.2", - "contentHash": "aHzQWgDMVBnk39HhQVmn06w+YxzF1h2V5/M4WgrNQAn7q97GR4Si3vLRTDlmJo9nK/Nknce+H4tXx4gqOKyLeg==", + "requested": "[17.9.0, )", + "resolved": "17.9.0", + "contentHash": "1ilw/8vgmjLyKU+2SKXKXaOqpYFJCQfGqGz+x0cosl981VzjrY74Sv6qAJv+neZMZ9ZMxF3ArN6kotaQ4uvEBw==", "dependencies": { - "NuGet.Frameworks": "6.5.0", "System.Reflection.Metadata": "1.6.0" } }, "Microsoft.TestPlatform.Portable": { "type": "Direct", - "requested": "[17.7.2, )", - "resolved": "17.7.2", - "contentHash": "jn5HtJxzyUod46kOVuj7CPl2thUXDUJvfQ/sZ/UCv8xu8cNvJJQvlc6eh0nYafMzLjkaBulc0piH7a9v1PV/UA==" + "requested": "[17.9.0, )", + "resolved": "17.9.0", + "contentHash": "0u2DjCU6eClfVPmJEWaiZuvSW9kiIR13LvwrdZ4ir7BvQL7d/RTuTzvOApo7JT9/d8wXLG2wOB7N+H4WN+MZcQ==" }, "Microsoft.TestPlatform.TranslationLayer": { "type": "Direct", - "requested": "[17.7.2, )", - "resolved": "17.7.2", - "contentHash": "wzWLmfZEWxKQRNq5axAtmVJiprKzR+kx87b8uIsRKYnkA6F8tV1yScMaKjAzbA8D+iV61q0i8fEhjqinQ23HqQ==", + "requested": "[17.9.0, )", + "resolved": "17.9.0", + "contentHash": "rKQeTUogF3XMV2WhtgEJ1IGfD5yNIXI0YzHb3Vt7sWSccH4f27IQGt4KUbqklVIVo99vE8g30qmplPokM1x4Lw==", "dependencies": { "NETStandard.Library": "2.0.0" } @@ -158,30 +160,30 @@ }, "NuGet.Frameworks": { "type": "Direct", - "requested": "[6.7.0, )", - "resolved": "6.7.0", - "contentHash": "mTKaTSINpCjMHTNdaPMD/0nfHvWGetG67KzWtDJklnAp9nNwqA+t65G0v8XA/Ve35ipmPRdklxFIl3O55iTgnQ==" + "requested": "[6.9.1, )", + "resolved": "6.9.1", + "contentHash": "DaKh3lenPUvzGccPkbI97BIvA27z+/UsL3ankfoZlX/4vBVDK5N1sheFTQ+GuJf+IgSzsJz/A21SPUpQLHwUtA==" }, "ResXResourceReader.NetStandard": { "type": "Direct", - "requested": "[1.1.0, )", - "resolved": "1.1.0", - "contentHash": "srjCLsiCBORsZUqfe/jkDRQDp47twhqna1bR14pNE2095dly7ejzmu1lN9pkvdHumzZwT5dtfbtzOnIXnFx3Ew==" + "requested": "[1.2.0, )", + "resolved": "1.2.0", + "contentHash": "WeSQmhW1ElwZRcr+v5arrsDCMEhZPxtpS1I6ZR78eVVDaPXjI8fAgoS8WA5nS6r5xALtYaPU0Ygs0VjsInccaQ==" }, "Serilog": { "type": "Direct", - "requested": "[3.0.1, )", - "resolved": "3.0.1", - "contentHash": "E4UmOQ++eNJax1laE+lws7E3zbhKgHsGJbO7ra0yE5smUh+5FfUPIKKBxM3MO1tK4sgpQke6/pLReDxIc/ggNw==" + "requested": "[3.1.1, )", + "resolved": "3.1.1", + "contentHash": "P6G4/4Kt9bT635bhuwdXlJ2SCqqn2nhh4gqFqQueCOr9bK/e7W9ll/IoX1Ter948cV2Z/5+5v8pAfJYUISY03A==" }, "Serilog.Extensions.Logging": { "type": "Direct", - "requested": "[7.0.0, )", - "resolved": "7.0.0", - "contentHash": "9faU0zNQqU7I6soVhLUMYaGNpgWv6cKlKb2S5AnS8gXxzW/em5Ladm/6FMrWTnX41cdbdGPOWNAo6adi4WaJ6A==", + "requested": "[8.0.0, )", + "resolved": "8.0.0", + "contentHash": "YEAMWu1UnWgf1c1KP85l1SgXGfiVo0Rz6x08pCiPOIBt2Qe18tcZLvdBUuV5o1QHvrs8FAry9wTIhgBRtjIlEg==", "dependencies": { - "Microsoft.Extensions.Logging": "7.0.0", - "Serilog": "2.12.0" + "Microsoft.Extensions.Logging": "8.0.0", + "Serilog": "3.1.1" } }, "Serilog.Extensions.Logging.File": { @@ -201,11 +203,11 @@ }, "Serilog.Sinks.Console": { "type": "Direct", - "requested": "[4.1.0, )", - "resolved": "4.1.0", - "contentHash": "K6N5q+5fetjnJPvCmkWOpJ/V8IEIoMIB1s86OzBrbxwTyHxdx3pmz4H+8+O/Dc/ftUX12DM1aynx/dDowkwzqg==", + "requested": "[5.0.1, )", + "resolved": "5.0.1", + "contentHash": "6Jt8jl9y2ey8VV7nVEUAyjjyxjAQuvd5+qj4XYAT9CwcsvR70HHULGBeD+K2WCALFXf7CFsNQT4lON6qXcu2AA==", "dependencies": { - "Serilog": "2.10.0" + "Serilog": "3.1.1" } }, "ShellProgressBar": { @@ -220,74 +222,104 @@ }, "Spectre.Console": { "type": "Direct", - "requested": "[0.47.0, )", - "resolved": "0.47.0", - "contentHash": "wz8mszcZr0cSOo8GyoG9e2DFW0SkMT8/n78Q/lIXX7EbCtHNXOoOKWpJ9Str+rCYtmQOGGyDutZzubrUHK/XkA==", + "requested": "[0.48.0, )", + "resolved": "0.48.0", + "contentHash": "4Mc1UT7Azgtyb8FyNwK5FZmoZbKuT5PmY7ZwaKUytjD5kGFMNBACpOZTwYtkuY377YkYtZYBeDDTJUwTW86QXw==", "dependencies": { "System.Memory": "4.5.5" } }, "Spectre.Console.Analyzer": { "type": "Direct", - "requested": "[0.47.0, )", - "resolved": "0.47.0", - "contentHash": "B2t1ha50pgEn1er2j5cv9RnJRX0bGhJDubkWr+KOcX5KjwVD83DvLXBVfixkiawuPFvh/Ggm1Wu07Qk96BbazA==" + "requested": "[0.48.0, )", + "resolved": "0.48.0", + "contentHash": "AwFgBqWxHv/pr9OuvB5Ki7daXfZMqMlireArEt9WwO2HZ4cS1XvYhDVu0itseInjZzEA/fJsPN1eqoV3vFNCwA==" }, "TestableIO.System.IO.Abstractions.Wrappers": { "type": "Direct", - "requested": "[19.2.69, )", - "resolved": "19.2.69", - "contentHash": "yHPZKCrsaVoA/LuZRqarYhecFJ+hUnQFXXfTvFfFaGdfKhCUYN7oo1CPgtMcr2TqLA2usGpSPZ2R7ybDWotY/g==", + "requested": "[20.0.15, )", + "resolved": "20.0.15", + "contentHash": "ylbWPBEeX8oS2Uj8pCOyFPfBRJ1JHc56YyHEa1IaaYpW4QDH5zw3H/CRm2R6V0PWCG+Fx+tpb09vkD6Y97UB2Q==", + "dependencies": { + "TestableIO.System.IO.Abstractions": "20.0.15" + } + }, + "Azure.Core": { + "type": "Transitive", + "resolved": "1.36.0", + "contentHash": "vwqFZdHS4dzPlI7FFRkPx9ctA+aGGeRev3gnzG8lntWvKMmBhAmulABi1O9CEvS3/jzYt7yA+0pqVdxkpAd7dQ==", + "dependencies": { + "Microsoft.Bcl.AsyncInterfaces": "1.1.1", + "System.Diagnostics.DiagnosticSource": "6.0.1", + "System.Memory.Data": "1.0.2", + "System.Numerics.Vectors": "4.5.0", + "System.Text.Encodings.Web": "4.7.2", + "System.Text.Json": "4.7.2", + "System.Threading.Tasks.Extensions": "4.5.4" + } + }, + "Azure.Storage.Common": { + "type": "Transitive", + "resolved": "12.18.1", + "contentHash": "ohCslqP9yDKIn+DVjBEOBuieB1QwsUCz+BwHYNaJ3lcIsTSiI4Evnq81HcKe8CqM8qvdModbipVQKpnxpbdWqA==", "dependencies": { - "TestableIO.System.IO.Abstractions": "19.2.69" + "Azure.Core": "1.36.0", + "System.IO.Hashing": "6.0.0" } }, "Buildalyzer.Logger": { "type": "Transitive", - "resolved": "5.0.1", - "contentHash": "7j7SzfYH69xuNFaGHbf6kRcvPUmeTUOV99+63lM0BPn2L4ThlqU7OM0aliVvlNOp5btr4nuU6kQdet5U3G7kyg==" + "resolved": "6.0.4", + "contentHash": "IaGSpOOfmZttHXMT6yCbWCPHM/0GnJ2KyELzHVCBJDdyd84qeYDpw1dWFDy1RNfNFeWjjkEVZ6wgX6RJ9v4L5w==" }, "FSharp.Core": { "type": "Transitive", - "resolved": "6.0.7", - "contentHash": "e6wGrq5smV3Yk2fBE/Y0nBG5oFyF59k5Je0a0QDydUpg6liyaafGjD3xvutciKepCP2knspZ/sWViC/F1OyyQQ==" + "resolved": "7.0.0-beta.22427.1", + "contentHash": "gN1fbULC6ji7IEUCIF4V8yta3Np/8av9H0SfanhACbmsNq9e0He9NOj8Dx0M9xsgYlwviCa0qV2P4B6qAjPOBA==" }, "LibGit2Sharp.NativeBinaries": { "type": "Transitive", - "resolved": "2.0.320", - "contentHash": "7vIqOhB+5LOi9arXi8IdlkWURpQEiMtnwVP//djA7cQvIVfpC4bZSnQIDe4kwwvsU/w1oH0YkBTgMmpkVndNbg==" + "resolved": "2.0.321", + "contentHash": "6445xs5v3j84n68kKiZzJjpTvCtfwt3Z46MaToEMCN4NBWYICsMd1AstVGcTp1v/Gv+hdio0tD1NLmo3dgR64Q==" + }, + "Microsoft.Bcl.AsyncInterfaces": { + "type": "Transitive", + "resolved": "1.1.1", + "contentHash": "yuvf07qFWFqtK3P/MRkEKLhn5r2UbSpVueRziSqj0yJQIKFwG1pq9mOayK3zE5qZCTs0CbrwL9M6R8VwqyGy2w==" }, "Microsoft.Build": { "type": "Transitive", - "resolved": "16.9.0", - "contentHash": "lTwFuDn2qnb7RJcjnxSBlwR+XDtr0/Tcx2WW8jr3ThP95XCilxWCiKXIWP8EeQ7qK/OEbAc6b+yfg3lzmCpvRA==", + "resolved": "17.0.1", + "contentHash": "sNhRGwqVoyj9+PTg5D/ntbB4TPRAx/sCF0qmJ2bB93c62KniyPGPbahf0FXD1rpeQitXDo52p3F5kRZBg+l0dw==", "dependencies": { - "Microsoft.Build.Framework": "16.9.0", + "Microsoft.Build.Framework": "17.0.1", + "Microsoft.NET.StringTools": "1.0.0", "Microsoft.Win32.Registry": "4.3.0", "System.Collections.Immutable": "5.0.0", - "System.Memory": "4.5.4", + "System.Configuration.ConfigurationManager": "4.7.0", "System.Reflection.Metadata": "1.6.0", "System.Security.Principal.Windows": "4.7.0", "System.Text.Encoding.CodePages": "4.0.1", - "System.Text.Json": "4.7.0", + "System.Text.Json": "5.0.2", "System.Threading.Tasks.Dataflow": "4.9.0" } }, "Microsoft.Build.Framework": { "type": "Transitive", - "resolved": "17.0.0", - "contentHash": "XbFA0z+6Ws2pNeRXYcDF3lKlNgRoSGMm2Q5HKzZD+EbwYMKPKrl/BJnnkMuDJHU0KravYHfhzBnLLJpPeZ3E7A==", + "resolved": "17.1.0", + "contentHash": "7PPEbjuL/lKQ8ftblxwBZKf5alZCA4GDvBTiO3UAVxtRe52a2jL3mc8TpKNiJZzytGz7fKdR5ClDCs7+Uw4hMg==", "dependencies": { + "Microsoft.Win32.Registry": "4.3.0", "System.Security.Permissions": "4.7.0" } }, "Microsoft.Build.Tasks.Core": { "type": "Transitive", - "resolved": "17.0.0", - "contentHash": "6772b15xCfwBRkz8MzGZb1YpyvvZmAtCbSx9frZJ0bpXKrhyN/+BP9mOjp2xVaJPyNBOfh9CwUOo+mnJheO/pw==", + "resolved": "17.1.0", + "contentHash": "obCL4Tb2wpc684sCTlS4hriNhI+6MBqlVWOQoajo9zYv/aqAN53YdIZ3Lnw5XszoYCCQexy2sT/MNElMgoSN9g==", "dependencies": { - "Microsoft.Build.Framework": "17.0.0", - "Microsoft.Build.Utilities.Core": "17.0.0", + "Microsoft.Build.Framework": "17.1.0", + "Microsoft.Build.Utilities.Core": "17.1.0", "Microsoft.NET.StringTools": "1.0.0", "Microsoft.Win32.Registry": "4.3.0", "System.CodeDom": "4.4.0", @@ -297,7 +329,7 @@ "System.Security.Cryptography.Pkcs": "4.7.0", "System.Security.Cryptography.Xml": "4.7.0", "System.Security.Permissions": "4.7.0", - "System.Threading.Tasks.Dataflow": "4.9.0" + "System.Threading.Tasks.Dataflow": "6.0.0" } }, "Microsoft.Build.Tasks.Git": { @@ -307,10 +339,10 @@ }, "Microsoft.Build.Utilities.Core": { "type": "Transitive", - "resolved": "17.0.0", - "contentHash": "+eqDvecetKfsZR9WqLQ96F9xhxFb3m9VOjkyzuaA/2D1cub1aW9XyegZb8+gEpBa+o7dHnIN9FskC+tRXtqLSQ==", + "resolved": "17.1.0", + "contentHash": "JqhQ4q6L4IyA0Wh3PrDrxHHYMVHyOLIusyC4imAnhcnZiOC4+CwgVRSdo8fLsQmvz0Jab8FFrU1NPZFbDoxRng==", "dependencies": { - "Microsoft.Build.Framework": "17.0.0", + "Microsoft.Build.Framework": "17.1.0", "Microsoft.NET.StringTools": "1.0.0", "Microsoft.Win32.Registry": "4.3.0", "System.Collections.Immutable": "5.0.0", @@ -326,8 +358,8 @@ }, "Microsoft.CodeAnalysis.Common": { "type": "Transitive", - "resolved": "4.7.0", - "contentHash": "pD5S14xMUebSGYe75kt0q/aaS/ftvktSo/pEv7aX7hNPHfdZS+SZeXvkvcffGxWkunYOyRF9m1oN7zzSdYj9dQ==", + "resolved": "4.8.0", + "contentHash": "/jR+e/9aT+BApoQJABlVCKnnggGQbvGh7BKq2/wI1LamxC+LbzhcLj4Vj7gXCofl1n4E521YfF9w0WcASGg/KA==", "dependencies": { "Microsoft.CodeAnalysis.Analyzers": "3.3.4", "System.Collections.Immutable": "7.0.0", @@ -335,44 +367,6 @@ "System.Runtime.CompilerServices.Unsafe": "6.0.0" } }, - "Microsoft.CSharp": { - "type": "Transitive", - "resolved": "4.0.1", - "contentHash": "17h8b5mXa87XYKrrVqdgZ38JefSUqLChUQpXgSnpzsM0nDOhE40FTeNWOJ/YmySGV6tG6T8+hjz6vxbknHJr6A==", - "dependencies": { - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Dynamic.Runtime": "4.0.11", - "System.Globalization": "4.0.11", - "System.Linq": "4.1.0", - "System.Linq.Expressions": "4.1.0", - "System.ObjectModel": "4.0.12", - "System.Reflection": "4.1.0", - "System.Reflection.Extensions": "4.0.1", - "System.Reflection.Primitives": "4.0.1", - "System.Reflection.TypeExtensions": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.InteropServices": "4.1.0", - "System.Threading": "4.0.11" - } - }, - "Microsoft.DotNet.PlatformAbstractions": { - "type": "Transitive", - "resolved": "2.1.0", - "contentHash": "9KPDwvb/hLEVXYruVHVZ8BkebC8j17DmPb56LnqRF74HqSPLjCkrlFUjOtFpQPA2DeADBRTI/e69aCfRBfrhxw==", - "dependencies": { - "System.AppContext": "4.1.0", - "System.Collections": "4.0.11", - "System.IO": "4.1.0", - "System.IO.FileSystem": "4.0.1", - "System.Reflection.TypeExtensions": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.InteropServices": "4.1.0", - "System.Runtime.InteropServices.RuntimeInformation": "4.0.0" - } - }, "Microsoft.Extensions.Configuration.Abstractions": { "type": "Transitive", "resolved": "6.0.0", @@ -391,47 +385,38 @@ }, "Microsoft.Extensions.DependencyInjection": { "type": "Transitive", - "resolved": "7.0.0", - "contentHash": "elNeOmkeX3eDVG6pYVeV82p29hr+UKDaBhrZyWvWLw/EVZSYEkZlQdkp0V39k/Xehs2Qa0mvoCvkVj3eQxNQ1Q==", + "resolved": "8.0.0", + "contentHash": "V8S3bsm50ig6JSyrbcJJ8bW2b9QLGouz+G1miK3UTaOWmMtFwNNNzUf4AleyDWUmTrWMLNnFSLEQtxmxgNQnNQ==", "dependencies": { - "Microsoft.Extensions.DependencyInjection.Abstractions": "7.0.0" + "Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0" } }, "Microsoft.Extensions.DependencyInjection.Abstractions": { "type": "Transitive", - "resolved": "7.0.0", - "contentHash": "h3j/QfmFN4S0w4C2A6X7arXij/M/OVw3uQHSOFxnND4DyAzO1F9eMX7Eti7lU/OkSthEE0WzRsfT/Dmx86jzCw==" + "resolved": "8.0.0", + "contentHash": "cjWrLkJXK0rs4zofsK4bSdg+jhDLTaxrkXu4gS6Y7MAlCvRyNNgwY/lJi5RDlQOnSZweHqoyvgvbdvQsRIW+hg==" }, - "Microsoft.Extensions.DependencyModel": { + "Microsoft.Extensions.Logging.Abstractions": { "type": "Transitive", - "resolved": "2.1.0", - "contentHash": "nS2XKqi+1A1umnYNLX2Fbm/XnzCxs5i+zXVJ3VC6r9t2z0NZr9FLnJN4VQpKigdcWH/iFTbMuX6M6WQJcTjVIg==", + "resolved": "8.0.0", + "contentHash": "arDBqTgFCyS0EvRV7O3MZturChstm50OJ0y9bDJvAcmEPJm0FFpFyjU/JLYyStNGGey081DvnQYlncNX5SJJGA==", "dependencies": { - "Microsoft.DotNet.PlatformAbstractions": "2.1.0", - "Newtonsoft.Json": "9.0.1", - "System.Diagnostics.Debug": "4.0.11", - "System.Dynamic.Runtime": "4.0.11", - "System.Linq": "4.1.0" + "Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0" } }, - "Microsoft.Extensions.Logging.Abstractions": { - "type": "Transitive", - "resolved": "7.0.0", - "contentHash": "kmn78+LPVMOWeITUjIlfxUPDsI0R6G0RkeAMBmQxAJ7vBJn4q2dTva7pWi65ceN5vPGjJ9q/Uae2WKgvfktJAw==" - }, "Microsoft.Extensions.Options": { "type": "Transitive", - "resolved": "7.0.0", - "contentHash": "lP1yBnTTU42cKpMozuafbvNtQ7QcBjr/CcK3bYOGEMH55Fjt+iecXjT6chR7vbgCMqy3PG3aNQSZgo/EuY/9qQ==", + "resolved": "8.0.0", + "contentHash": "JOVOfqpnqlVLUzINQ2fox8evY2SKLYJ3BV8QDe/Jyp21u1T7r45x/R/5QdteURMR5r01GxeJSBBUOCOyaNXA3g==", "dependencies": { - "Microsoft.Extensions.DependencyInjection.Abstractions": "7.0.0", - "Microsoft.Extensions.Primitives": "7.0.0" + "Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0", + "Microsoft.Extensions.Primitives": "8.0.0" } }, "Microsoft.Extensions.Primitives": { "type": "Transitive", - "resolved": "7.0.0", - "contentHash": "um1KU5kxcRp3CNuI8o/GrZtD4AIOXDk+RLsytjZ9QPok3ttLUelLKpilVPuaFT3TFjOhSibUAso0odbOaCDj3Q==", + "resolved": "8.0.0", + "contentHash": "bXJEZrW9ny8vjMF1JV253WeLhpEVzFo1lyaZu1vQ4ZxWUlVvknZ/+ftFgVheLubb4eZPSwwxBeqS1JkCOjxd8g==", "dependencies": { "System.Runtime.CompilerServices.Unsafe": "6.0.0" } @@ -531,13 +516,11 @@ }, "MSBuild.StructuredLogger": { "type": "Transitive", - "resolved": "2.1.507", - "contentHash": "/Tp6qc8MiBr91jaoHlgIWWOQXzOJs0CpQdeXmn8krpDrvbjQzcGu8iDDzIwGElkooGzUTxtGoKN1QJ9VNBrBDg==", + "resolved": "2.1.815", + "contentHash": "5UfWYgsWBGI3w0npjYLeXPv8TUcNmGB/QBhoYLDeYTosuvmG6pz6HPb+xPg/Boi1bmw2Bgnjo+XopcwzCbZAqg==", "dependencies": { - "Microsoft.Build": "16.4.0", - "Microsoft.Build.Framework": "16.4.0", - "Microsoft.Build.Tasks.Core": "16.4.0", - "Microsoft.Build.Utilities.Core": "16.4.0" + "Microsoft.Build.Framework": "16.10.0", + "Microsoft.Build.Utilities.Core": "16.10.0" } }, "MsBuildPipeLogger.Server": { @@ -556,35 +539,6 @@ "Microsoft.NETCore.Platforms": "1.1.0" } }, - "Newtonsoft.Json": { - "type": "Transitive", - "resolved": "9.0.1", - "contentHash": "U82mHQSKaIk+lpSVCbWYKNavmNH1i5xrExDEquU1i6I5pV6UMOqRnJRSlKO3cMPfcpp0RgDY+8jUXHdQ4IfXvw==", - "dependencies": { - "Microsoft.CSharp": "4.0.1", - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Dynamic.Runtime": "4.0.11", - "System.Globalization": "4.0.11", - "System.IO": "4.1.0", - "System.Linq": "4.1.0", - "System.Linq.Expressions": "4.1.0", - "System.ObjectModel": "4.0.12", - "System.Reflection": "4.1.0", - "System.Reflection.Extensions": "4.0.1", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.Serialization.Primitives": "4.1.1", - "System.Text.Encoding": "4.0.11", - "System.Text.Encoding.Extensions": "4.0.11", - "System.Text.RegularExpressions": "4.1.0", - "System.Threading": "4.0.11", - "System.Threading.Tasks": "4.0.11", - "System.Xml.ReaderWriter": "4.0.11", - "System.Xml.XDocument": "4.0.11" - } - }, "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl": { "type": "Transitive", "resolved": "4.3.0", @@ -734,14 +688,6 @@ "System.Text.Encoding.Extensions": "4.0.11" } }, - "System.AppContext": { - "type": "Transitive", - "resolved": "4.1.0", - "contentHash": "3QjO4jNV7PdKkmQAVp9atA+usVnKRwI3Kx1nMwJ93T0LcQfx7pKAYk0nKz5wn1oP5iqlhZuy6RXOFdhr7rDwow==", - "dependencies": { - "System.Runtime": "4.1.0" - } - }, "System.Buffers": { "type": "Transitive", "resolved": "4.5.1", @@ -808,14 +754,10 @@ }, "System.Diagnostics.DiagnosticSource": { "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "tD6kosZnTAGdrEa0tZSuFyunMbt/5KYDnHdndJYGqZoNy00XVXyACd5d6KnE1YgYv3ne2CjtAfNXo/fwEhnKUA==", + "resolved": "6.0.1", + "contentHash": "KiLYDu2k2J82Q9BJpWiuQqCkFjRBWVq4jDzKKWawVi9KWzyD0XG3cmfX0vqTQlL14Wi9EufJrbL0+KCLTbqWiQ==", "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Reflection": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading": "4.3.0" + "System.Runtime.CompilerServices.Unsafe": "6.0.0" } }, "System.Diagnostics.Process": { @@ -846,16 +788,6 @@ "runtime.native.System": "4.3.0" } }, - "System.Diagnostics.Tools": { - "type": "Transitive", - "resolved": "4.0.1", - "contentHash": "xBfJ8pnd4C17dWaC9FM6aShzbJcRNMChUMD42I6772KGGrqaFdumwhn9OdM68erj1ueNo3xdQ1EwiFjK5k8p0g==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.0.1", - "Microsoft.NETCore.Targets": "1.0.1", - "System.Runtime": "4.1.0" - } - }, "System.Diagnostics.TraceSource": { "type": "Transitive", "resolved": "4.3.0", @@ -891,28 +823,6 @@ "Microsoft.Win32.SystemEvents": "4.7.0" } }, - "System.Dynamic.Runtime": { - "type": "Transitive", - "resolved": "4.0.11", - "contentHash": "db34f6LHYM0U0JpE+sOmjar27BnqTVkbLJhgfwMpTdgTigG/Hna3m2MYVwnFzGGKnEJk2UXFuoVTr8WUbU91/A==", - "dependencies": { - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Globalization": "4.0.11", - "System.Linq": "4.1.0", - "System.Linq.Expressions": "4.1.0", - "System.ObjectModel": "4.0.12", - "System.Reflection": "4.1.0", - "System.Reflection.Emit": "4.0.1", - "System.Reflection.Emit.ILGeneration": "4.0.1", - "System.Reflection.Primitives": "4.0.1", - "System.Reflection.TypeExtensions": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Threading": "4.0.11" - } - }, "System.Globalization": { "type": "Transitive", "resolved": "4.3.0", @@ -982,6 +892,11 @@ "System.Runtime": "4.3.0" } }, + "System.IO.Hashing": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "Rfm2jYCaUeGysFEZjDe7j1R4x6Z6BzumS/vUT5a1AA/AWJuGX71PoGB0RmpyX3VmrGqVnAwtfMn39OHR8Y/5+g==" + }, "System.Linq": { "type": "Transitive", "resolved": "4.3.0", @@ -1038,6 +953,15 @@ "resolved": "4.5.5", "contentHash": "XIWiDvKPXaTveaB7HVganDlOCRoj03l+jrwNvcge/t8vhGYKvqV+dMv6G4SAX2NoNmN0wZfVPTAlFwZcZvVOUw==" }, + "System.Memory.Data": { + "type": "Transitive", + "resolved": "1.0.2", + "contentHash": "JGkzeqgBsiZwKJZ1IxPNsDFZDhUvuEdX8L8BDC8N3KOj+6zMcNU28CNN59TpZE/VJYy9cP+5M+sbxtWJx3/xtw==", + "dependencies": { + "System.Text.Encodings.Web": "4.7.2", + "System.Text.Json": "4.6.0" + } + }, "System.Net.Http": { "type": "Transitive", "resolved": "4.3.0", @@ -1148,6 +1072,11 @@ "System.Runtime.Extensions": "4.3.0" } }, + "System.Numerics.Vectors": { + "type": "Transitive", + "resolved": "4.5.0", + "contentHash": "QQTlPTl06J/iiDbJCiepZ4H//BVraReU4O4EoRw1U02H5TLUIT7xn3GnDp9AXPSlJUDyFs4uWjWafNX6WrAojQ==" + }, "System.ObjectModel": { "type": "Transitive", "resolved": "4.3.0", @@ -1236,8 +1165,12 @@ }, "System.Reflection.TypeExtensions": { "type": "Transitive", - "resolved": "4.7.0", - "contentHash": "VybpaOQQhqE6siHppMktjfGBw1GCwvCqiufqmP8F1nj7fTUNtW35LOEt3UZTEsECfo+ELAl/9o9nJx3U91i7vA==" + "resolved": "4.3.0", + "contentHash": "7u6ulLcZbyxB5Gq0nMkQttcdBTx57ibzw+4IOXEfR+sXYQoHvjW5LTLyNr8O22UIMrqYbchJQJnos4eooYzYJA==", + "dependencies": { + "System.Reflection": "4.3.0", + "System.Runtime": "4.3.0" + } }, "System.Resources.Extensions": { "type": "Transitive", @@ -1338,15 +1271,6 @@ "System.Runtime.Extensions": "4.3.0" } }, - "System.Runtime.Serialization.Primitives": { - "type": "Transitive", - "resolved": "4.1.1", - "contentHash": "HZ6Du5QrTG8MNJbf4e4qMO3JRAkIboGT5Fk804uZtg3Gq516S7hAqTm2UZKUHa7/6HUGdVy3AqMQKbns06G/cg==", - "dependencies": { - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0" - } - }, "System.Security.AccessControl": { "type": "Transitive", "resolved": "4.7.0", @@ -1585,23 +1509,15 @@ "System.Text.Encoding": "4.3.0" } }, - "System.Text.Json": { + "System.Text.Encodings.Web": { "type": "Transitive", - "resolved": "4.7.0", - "contentHash": "IPq/x/d5nAcnD3vIyM3AbPOaTgcqrh0AqPSx7U53UFu3M6k1TH1u/eXc9/h4jm/3mpP1WRUpevlPY4PACd7AWw==" + "resolved": "4.7.2", + "contentHash": "iTUgB/WtrZ1sWZs84F2hwyQhiRH6QNjQv2DkwrH+WP6RoFga2Q1m3f9/Q7FG8cck8AdHitQkmkXSY8qylcDmuA==" }, - "System.Text.RegularExpressions": { + "System.Text.Json": { "type": "Transitive", - "resolved": "4.1.0", - "contentHash": "i88YCXpRTjCnoSQZtdlHkAOx4KNNik4hMy83n0+Ftlb7jvV6ZiZWMpnEZHhjBp6hQVh8gWd/iKNPzlPF7iyA2g==", - "dependencies": { - "System.Collections": "4.0.11", - "System.Globalization": "4.0.11", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Threading": "4.0.11" - } + "resolved": "5.0.2", + "contentHash": "I47dVIGiV6SfAyppphxqupertT/5oZkYLDCX6vC3HpOI4ZLjyoKAreUoem2ie6G0RbRuFrlqz/PcTQjfb2DOfQ==" }, "System.Threading": { "type": "Transitive", @@ -1624,18 +1540,13 @@ }, "System.Threading.Tasks.Dataflow": { "type": "Transitive", - "resolved": "4.9.0", - "contentHash": "dTS+3D/GtG2/Pvc3E5YzVvAa7aQJgLDlZDIzukMOJjYudVOQOUXEU68y6Zi3Nn/jqIeB5kOCwrGbQFAKHVzXEQ==" + "resolved": "6.0.0", + "contentHash": "+tyDCU3/B1lDdOOAJywHQoFwyXIUghIaP2BxG79uvhfTnO+D9qIgjVlL/JV2NTliYbMHpd6eKDmHp2VHpij7MA==" }, "System.Threading.Tasks.Extensions": { "type": "Transitive", - "resolved": "4.0.0", - "contentHash": "pH4FZDsZQ/WmgJtN4LWYmRdJAEeVkyriSwrv2Teoe5FOU0Yxlb6II6GL8dBPOfRmutHGATduj3ooMt7dJ2+i+w==", - "dependencies": { - "System.Collections": "4.0.11", - "System.Runtime": "4.1.0", - "System.Threading.Tasks": "4.0.11" - } + "resolved": "4.5.4", + "contentHash": "zteT+G8xuGu6mS+mzDzYXbzS7rd3K6Fjb9RiZlYlJPam2/hU7JCBZBVEcywNuR+oZ1ncTvc/cq0faRr3P01OVg==" }, "System.Threading.Tasks.Parallel": { "type": "Transitive", @@ -1687,63 +1598,22 @@ "System.Drawing.Common": "4.7.0" } }, - "System.Xml.ReaderWriter": { - "type": "Transitive", - "resolved": "4.0.11", - "contentHash": "ZIiLPsf67YZ9zgr31vzrFaYQqxRPX9cVHjtPSnmx4eN6lbS/yEyYNr2vs1doGDEscF0tjCZFsk9yUg1sC9e8tg==", - "dependencies": { - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Globalization": "4.0.11", - "System.IO": "4.1.0", - "System.IO.FileSystem": "4.0.1", - "System.IO.FileSystem.Primitives": "4.0.1", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.InteropServices": "4.1.0", - "System.Text.Encoding": "4.0.11", - "System.Text.Encoding.Extensions": "4.0.11", - "System.Text.RegularExpressions": "4.1.0", - "System.Threading.Tasks": "4.0.11", - "System.Threading.Tasks.Extensions": "4.0.0" - } - }, - "System.Xml.XDocument": { - "type": "Transitive", - "resolved": "4.0.11", - "contentHash": "Mk2mKmPi0nWaoiYeotq1dgeNK1fqWh61+EK+w4Wu8SWuTYLzpUnschb59bJtGywaPq7SmTuPf44wrXRwbIrukg==", - "dependencies": { - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Diagnostics.Tools": "4.0.1", - "System.Globalization": "4.0.11", - "System.IO": "4.1.0", - "System.Reflection": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Text.Encoding": "4.0.11", - "System.Threading": "4.0.11", - "System.Xml.ReaderWriter": "4.0.11" - } - }, "TestableIO.System.IO.Abstractions": { "type": "Transitive", - "resolved": "19.2.69", - "contentHash": "BHZ9uqMAPG7TId4dwJPEuofR6NjIu8AycwH8qSWTSLYUKpQzJKFMIgo7Igp37BW3oURRdIs5Dx4+W86BqvEXrg==" + "resolved": "20.0.15", + "contentHash": "ohYr5VOrTGO+8ZVvaWZGg5vn7wQIYmAT35pjrxZ/NNbC4yamMw2JYDFv73rhpOjE/7PkuwV2Mk9GMR6hY527Gw==" }, "stryker.datacollector": { "type": "Project", "dependencies": { - "Microsoft.TestPlatform.ObjectModel": "17.7.2", - "Microsoft.TestPlatform.Portable": "17.7.2" + "Microsoft.TestPlatform.ObjectModel": "[17.9.0, )", + "Microsoft.TestPlatform.Portable": "[17.9.0, )" } }, "stryker.regexmutators": { "type": "Project", "dependencies": { - "RegexParser": "0.5.1" + "RegexParser": "[0.5.1, )" } }, "RegexParser": { diff --git a/src/Stryker.RegexMutators/Stryker.RegexMutators.UnitTest/packages.lock.json b/src/Stryker.RegexMutators/Stryker.RegexMutators.UnitTest/packages.lock.json index 518be5970d..15c48a19d5 100644 --- a/src/Stryker.RegexMutators/Stryker.RegexMutators.UnitTest/packages.lock.json +++ b/src/Stryker.RegexMutators/Stryker.RegexMutators.UnitTest/packages.lock.json @@ -209,7 +209,7 @@ "stryker.regexmutators": { "type": "Project", "dependencies": { - "RegexParser": "0.5.1" + "RegexParser": "[0.5.1, )" } }, "Microsoft.TestPlatform.ObjectModel": { From e51eebd0ef6a02ea5ebe597b8484a395bd257c66 Mon Sep 17 00:00:00 2001 From: Richard Werkman Date: Fri, 16 Feb 2024 14:36:30 +0100 Subject: [PATCH 21/27] Update pipeline docs --- docs/stryker-in-pipeline.md | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/docs/stryker-in-pipeline.md b/docs/stryker-in-pipeline.md index 20ee05334c..d62b4c3dfb 100644 --- a/docs/stryker-in-pipeline.md +++ b/docs/stryker-in-pipeline.md @@ -37,22 +37,39 @@ And then running this locally installed tool: Dashboard compare is very useful when running stryker in pipelines because it cuts down on the total runtime by only testing mutations that have changed compared to for example master The following minimal steps are needed to use dashboard compare -1. Enable --with-baseline and choose the comparison target -1. Choose a storage provider (Dashboard for public projects or Azure File Share for private projects) +1. Enable [with-baseline](https://stryker-mutator.io/docs/stryker-net/configuration#with-baseline-committish) +1. Choose a target branch or commit, as the source of the baseline (usually current branch in your pull request) +1. Choose a [storage provider](https://stryker-mutator.io/docs/stryker-net/configuration#baselineprovider-string) (Dashboard for public projects or Azure File Share for private projects) 1. Set up authentication for the chosen storage provider -1. Set --version to the name of the source branch (usually current branch) 1. Set any other options needed for your chosen storage provider (see: [storage provider docs](https://stryker-mutator.io/docs/stryker-net/configuration#baselineprovider-string)) -Example for azure devops with dashboard storage provider: +_Example for azure devops with dashboard storage provider:_ ``` -dotnet stryker --with-baseline:$(System.PullRequest.TargetBranch) --dashboard-api-key $(Stryker.Dashboard.Api.Key) --version $(System.PullRequest.SourceBranch) +dotnet stryker with-baseline $(System.PullRequest.TargetBranch) --dashboard-api-key $(Stryker.Dashboard.Api.Key) --version $(System.PullRequest.SourceBranch) ``` ```json { "stryker-config": { "baseline": { - "provider": "Dashboard" + "provider": "Dashboard", + "fallback-version": "main" + } + } +} +``` + +_Example for azure devops with azure fileshare storage provider:_ +``` +dotnet stryker with-baseline $(System.PullRequest.TargetBranch) --azure-fileshare-sas $(Stryker.Azure.Fileshare.SAS) +``` + +```json +{ + "stryker-config": { + "baseline": { + "provider": "AzureFileStorage", + "fallback-version": "main" } } } From d0fa85ae286018b610a3d5936c2235ea5c3ef1ff Mon Sep 17 00:00:00 2001 From: Richard Werkman Date: Fri, 1 Mar 2024 09:36:23 +0100 Subject: [PATCH 22/27] . --- src/Stryker.Core/Stryker.Core/StrykerRunner.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Stryker.Core/Stryker.Core/StrykerRunner.cs b/src/Stryker.Core/Stryker.Core/StrykerRunner.cs index 15837b9e44..a2559ede45 100644 --- a/src/Stryker.Core/Stryker.Core/StrykerRunner.cs +++ b/src/Stryker.Core/Stryker.Core/StrykerRunner.cs @@ -126,7 +126,6 @@ public StrykerRunResult RunMutationTest(IStrykerInputs inputs, ILoggerFactory lo reporters.OnAllMutantsTested(rootComponent, combinedTestProjectsInfo); - return new StrykerRunResult(options, rootComponent.GetMutationScore()); } #if !DEBUG @@ -136,7 +135,6 @@ public StrykerRunResult RunMutationTest(IStrykerInputs inputs, ILoggerFactory lo _logger.LogError(ex, "An error occurred during the mutation test run "); throw; } - #endif finally { From d7ac6531af0d1ad81873a40696a09e9651c834cd Mon Sep 17 00:00:00 2001 From: Richard Werkman Date: Fri, 1 Mar 2024 10:49:12 +0100 Subject: [PATCH 23/27] Fix tests --- .../Stryker.CLI.UnitTest/StrykerCLITests.cs | 23 ------------------- .../CommandLineConfigReader.cs | 5 +--- .../NullCoalescingExpressionMutatorTests.cs | 4 ++-- 3 files changed, 3 insertions(+), 29 deletions(-) diff --git a/src/Stryker.CLI/Stryker.CLI.UnitTest/StrykerCLITests.cs b/src/Stryker.CLI/Stryker.CLI.UnitTest/StrykerCLITests.cs index 1cea090307..12e77e19fe 100644 --- a/src/Stryker.CLI/Stryker.CLI.UnitTest/StrykerCLITests.cs +++ b/src/Stryker.CLI/Stryker.CLI.UnitTest/StrykerCLITests.cs @@ -416,29 +416,6 @@ public void ShouldSupplyWithBaselineWhenPassed(params string[] argName) _inputs.BaselineEnabledInput.SuppliedInput.Value.ShouldBeTrue(); } - [Theory] - [InlineData("baseline")] - public void ShouldSupplyWithBaselineWhenCommandPassed(params string[] argName) - { - _target.Run(argName); - - _strykerRunnerMock.VerifyAll(); - - _inputs.BaselineEnabledInput.SuppliedInput.Value.ShouldBeTrue(); - } - - [Theory] - [InlineData("baseline", "recreate")] - public void ShouldSetBaselineRecreateWhenCommandPassed(params string[] argName) - { - _target.Run(argName); - - _strykerRunnerMock.VerifyAll(); - - _inputs.BaselineEnabledInput.SuppliedInput.Value.ShouldBeTrue(); - _inputs.BaselineRecreateEnabledInput.SuppliedInput.ShouldBeTrue(); - } - [Theory] [InlineData("-o", null)] [InlineData("-o:html", "html")] diff --git a/src/Stryker.CLI/Stryker.CLI/CommandLineConfig/CommandLineConfigReader.cs b/src/Stryker.CLI/Stryker.CLI/CommandLineConfig/CommandLineConfigReader.cs index 4109f4d959..d19d1ca895 100644 --- a/src/Stryker.CLI/Stryker.CLI/CommandLineConfig/CommandLineConfigReader.cs +++ b/src/Stryker.CLI/Stryker.CLI/CommandLineConfig/CommandLineConfigReader.cs @@ -84,10 +84,7 @@ public void RegisterBaselineCommand(CommandLineApplication app, IStrykerInputs i baselineCmd.OnExecute(() => { - if (committish.HasValue) - { - inputs.BaselineTargetInput.SuppliedInput = committish.Value; - } + inputs.BaselineTargetInput.SuppliedInput = committish.Value; inputs.BaselineEnabledInput.SuppliedInput = true; baselineCmd.Description = "Starts a stryker run based on the results of a previous run."; return strykerCli.StartApp(inputs, args, app, this); diff --git a/src/Stryker.Core/Stryker.Core.UnitTest/Mutators/NullCoalescingExpressionMutatorTests.cs b/src/Stryker.Core/Stryker.Core.UnitTest/Mutators/NullCoalescingExpressionMutatorTests.cs index fa1f59011f..9a7b569edb 100644 --- a/src/Stryker.Core/Stryker.Core.UnitTest/Mutators/NullCoalescingExpressionMutatorTests.cs +++ b/src/Stryker.Core/Stryker.Core.UnitTest/Mutators/NullCoalescingExpressionMutatorTests.cs @@ -10,10 +10,10 @@ namespace Stryker.Core.UnitTest.Mutators public class NullCoalescingExpressionMutatorTests : TestBase { [Fact] - public void ShouldBeMutationLevelStandard() + public void ShouldBeMutationLevelBasic() { var target = new NullCoalescingExpressionMutator(); - target.MutationLevel.ShouldBe(MutationLevel.Standard); + target.MutationLevel.ShouldBe(MutationLevel.Basic); } [Fact] From e87f5bb898a165dcc596464fdf169dc34370046b Mon Sep 17 00:00:00 2001 From: Richard Werkman Date: Fri, 1 Mar 2024 11:12:05 +0100 Subject: [PATCH 24/27] Fix sonar --- src/Stryker.Core/Stryker.Core/Options/StrykerInputs.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Stryker.Core/Stryker.Core/Options/StrykerInputs.cs b/src/Stryker.Core/Stryker.Core/Options/StrykerInputs.cs index ae1e02f41c..bb9a0b319e 100644 --- a/src/Stryker.Core/Stryker.Core/Options/StrykerInputs.cs +++ b/src/Stryker.Core/Stryker.Core/Options/StrykerInputs.cs @@ -120,7 +120,6 @@ public StrykerOptions ValidateAll() var baselineProvider = BaselineProviderInput.Validate(reporters, baselineEnabled); var sinceEnabled = SinceInput.Validate(BaselineEnabledInput.SuppliedInput); var sinceTarget = SinceTargetInput.Validate(sinceEnabled); - var projectVersion = ProjectVersionInput.Validate(reporters, baselineEnabled); _strykerOptionsCache ??= new StrykerOptions() { From 0380d096852c3262212fcef6aa6152941be07262 Mon Sep 17 00:00:00 2001 From: Richard Werkman Date: Fri, 15 Mar 2024 11:09:01 +0100 Subject: [PATCH 25/27] Fix docs --- docs/configuration.md | 2 +- .../CommandLineConfig/CommandLineConfigReader.cs | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/docs/configuration.md b/docs/configuration.md index ac2b143ea0..cfd5a1566a 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -594,7 +594,7 @@ For more information on how to configure a SAS check the [Azure documentation](h ### `baseline recreate` Default: `false` -Command line: `baseline recreate main` +Command line: `with-baseline main recreate` Config file: `N/A` Sometimes your baseline can get corrupted or out of touch with reality. In that case the baseline can be recreated using this command. This will test all mutations in your project and save the result as the new baseline. diff --git a/src/Stryker.CLI/Stryker.CLI/CommandLineConfig/CommandLineConfigReader.cs b/src/Stryker.CLI/Stryker.CLI/CommandLineConfig/CommandLineConfigReader.cs index d19d1ca895..5684cbc50c 100644 --- a/src/Stryker.CLI/Stryker.CLI/CommandLineConfig/CommandLineConfigReader.cs +++ b/src/Stryker.CLI/Stryker.CLI/CommandLineConfig/CommandLineConfigReader.cs @@ -77,14 +77,14 @@ public void RegisterBaselineCommand(CommandLineApplication app, IStrykerInputs i baselineCmd.AddName("with-baseline"); RegisterCliInputs(baselineCmd); - var committish = baselineCmd.Argument("committish", "The committish to compare with the current HEAD. This can be a branch, tag or commit id."); - committish.IsRequired(true); + var committishArg = baselineCmd.Argument("committish", "The committish to compare with the current HEAD. This can be a branch, tag or commit id."); + committishArg.IsRequired(true); baselineCmd.HelpOption(); baselineCmd.OnExecute(() => { - inputs.BaselineTargetInput.SuppliedInput = committish.Value; + inputs.BaselineTargetInput.SuppliedInput = committishArg.Value; inputs.BaselineEnabledInput.SuppliedInput = true; baselineCmd.Description = "Starts a stryker run based on the results of a previous run."; return strykerCli.StartApp(inputs, args, app, this); @@ -98,10 +98,7 @@ public void RegisterBaselineCommand(CommandLineApplication app, IStrykerInputs i createCmd.OnExecute(() => { - if (committish.HasValue) - { - inputs.BaselineTargetInput.SuppliedInput = committish.Value; - } + inputs.BaselineTargetInput.SuppliedInput = committishArg.Value; inputs.BaselineEnabledInput.SuppliedInput = true; createCmd.Description = "Creates a new baseline by doing a full stryker run"; // Enable recreate From 0ba1d0836a52c0fc7c5aaaf5a60fbf19d7455102 Mon Sep 17 00:00:00 2001 From: Richard Werkman Date: Fri, 15 Mar 2024 11:10:12 +0100 Subject: [PATCH 26/27] Fix unit tests --- src/Stryker.CLI/Stryker.CLI.UnitTest/filled-stryker-config.json | 1 - src/Stryker.CLI/Stryker.CLI.UnitTest/filled-stryker-config.yaml | 1 - 2 files changed, 2 deletions(-) diff --git a/src/Stryker.CLI/Stryker.CLI.UnitTest/filled-stryker-config.json b/src/Stryker.CLI/Stryker.CLI.UnitTest/filled-stryker-config.json index e520311747..95dcfca6c8 100644 --- a/src/Stryker.CLI/Stryker.CLI.UnitTest/filled-stryker-config.json +++ b/src/Stryker.CLI/Stryker.CLI.UnitTest/filled-stryker-config.json @@ -49,7 +49,6 @@ "module": "cli" }, "baseline": { - "enabled": false, "fallback-version": "master", "azure-fileshare-url": "", "provider": "" diff --git a/src/Stryker.CLI/Stryker.CLI.UnitTest/filled-stryker-config.yaml b/src/Stryker.CLI/Stryker.CLI.UnitTest/filled-stryker-config.yaml index e6d4c552e5..cc4efec953 100644 --- a/src/Stryker.CLI/Stryker.CLI.UnitTest/filled-stryker-config.yaml +++ b/src/Stryker.CLI/Stryker.CLI.UnitTest/filled-stryker-config.yaml @@ -39,7 +39,6 @@ stryker-config: version: master module: cli baseline: - enabled: false fallback-version: master azure-fileshare-url: '' provider: '' From 20cab0456025a9039f3c47090f0764573756b87f Mon Sep 17 00:00:00 2001 From: Richard Werkman Date: Fri, 21 Jun 2024 15:47:17 +0200 Subject: [PATCH 27/27] Remove double logging and refactor --- .../CommandLineConfigReader.cs | 5 ++- .../MutantFilters/BaselineMutantFilter.cs | 2 +- .../MutantFilters/SinceMutantFilter.cs | 36 +++++-------------- .../Options/Inputs/ProjectVersionInput.cs | 2 +- .../Stryker.Core/Options/StrykerInputs.cs | 2 +- .../Stryker.Core/Options/StrykerOptions.cs | 18 +++++----- 6 files changed, 23 insertions(+), 42 deletions(-) diff --git a/src/Stryker.CLI/Stryker.CLI/CommandLineConfig/CommandLineConfigReader.cs b/src/Stryker.CLI/Stryker.CLI/CommandLineConfig/CommandLineConfigReader.cs index fade647c60..daee12f312 100644 --- a/src/Stryker.CLI/Stryker.CLI/CommandLineConfig/CommandLineConfigReader.cs +++ b/src/Stryker.CLI/Stryker.CLI/CommandLineConfig/CommandLineConfigReader.cs @@ -77,9 +77,8 @@ public void RegisterBaselineCommand(CommandLineApplication app, IStrykerInputs i baselineCmd.AddName("with-baseline"); RegisterCliInputs(baselineCmd); - var committishArg = baselineCmd.Argument("committish", "The committish to compare with the current HEAD. This can be a branch, tag or commit id."); - committishArg.IsRequired(true); - + var committishArg = baselineCmd.Argument("target", "The target to compare with the current version. This can be any version indicator like branch, tag, commit-id or semver."); + committishArg.IsRequired(true, "The target argument is required. Example: dotnet stryker baseline main."); baselineCmd.HelpOption(); baselineCmd.OnExecute(() => diff --git a/src/Stryker.Core/Stryker.Core/MutantFilters/BaselineMutantFilter.cs b/src/Stryker.Core/Stryker.Core/MutantFilters/BaselineMutantFilter.cs index cd3f917889..f59a63c00a 100644 --- a/src/Stryker.Core/Stryker.Core/MutantFilters/BaselineMutantFilter.cs +++ b/src/Stryker.Core/Stryker.Core/MutantFilters/BaselineMutantFilter.cs @@ -118,7 +118,7 @@ private void SetMutantStatusToBaselineMutantStatus(JsonMutant baselineMutant, private async Task GetBaselineAsync() { - if (_options.BaselineRecreateEnabled) + if (_options.RecreateBaseline) { _logger.LogInformation("Now running a complete test to establish a fresh baseline."); diff --git a/src/Stryker.Core/Stryker.Core/MutantFilters/SinceMutantFilter.cs b/src/Stryker.Core/Stryker.Core/MutantFilters/SinceMutantFilter.cs index d6c30d3f44..6ad72666dd 100644 --- a/src/Stryker.Core/Stryker.Core/MutantFilters/SinceMutantFilter.cs +++ b/src/Stryker.Core/Stryker.Core/MutantFilters/SinceMutantFilter.cs @@ -26,26 +26,6 @@ public SinceMutantFilter(IDiffProvider diffProvider = null) _diffResult = diffProvider.ScanDiff(); _tests = diffProvider.Tests; - - if (_diffResult != null) - { - _logger.LogInformation("{ChangedFilesCount} files changed", (_diffResult.ChangedSourceFiles?.Count ?? 0) + (_diffResult.ChangedTestFiles?.Count ?? 0)); - - if (_diffResult.ChangedSourceFiles != null) - { - foreach (var changedFile in _diffResult.ChangedSourceFiles) - { - _logger.LogInformation("Changed file {ChangedFile}", changedFile); - } - } - if (_diffResult.ChangedTestFiles != null) - { - foreach (var changedFile in _diffResult.ChangedTestFiles) - { - _logger.LogInformation("Changed test file {ChangedFile}", changedFile); - } - } - } } public IEnumerable FilterMutants(IEnumerable mutants, IReadOnlyFileLeaf file, StrykerOptions options) @@ -54,14 +34,14 @@ public IEnumerable FilterMutants(IEnumerable mutants, IReadOnlyF IEnumerable filteredMutants; // A non-csharp file is flagged by the diff result as modified. We cannot determine which mutants will be affected by this, thus all mutants have to be tested. - if (_diffResult.ChangedTestFiles is { } && _diffResult.ChangedTestFiles.Any(x => !x.EndsWith(".cs"))) + if (_diffResult.ChangedTestFiles is not null && _diffResult.ChangedTestFiles.Any(x => !x.EndsWith(".cs"))) { _logger.LogDebug("Returning all mutants in {RelativePath} because a non-source file is modified", file.RelativePath); return SetMutantStatusForNonCSharpFileChanged(mutants); } // If the diff result flags this file as modified, we want to run all mutants again - if (_diffResult.ChangedSourceFiles != null && _diffResult.ChangedSourceFiles.Contains(file.FullPath)) + if (_diffResult.ChangedSourceFiles is not null && _diffResult.ChangedSourceFiles.Contains(file.FullPath)) { _logger.LogDebug("Returning all mutants in {RelativePath} because the file is modified", file.RelativePath); return SetMutantStatusForFileChanged(mutants); @@ -73,7 +53,7 @@ public IEnumerable FilterMutants(IEnumerable mutants, IReadOnlyF // If any of the tests have been changed, we want to return all mutants covered by these testfiles. // Only check for changed c# files. Other files have already been handled. - if (_diffResult.ChangedTestFiles != null && _diffResult.ChangedTestFiles.Any(file => file.EndsWith(".cs"))) + if (_diffResult.ChangedTestFiles is not null && _diffResult.ChangedTestFiles.Any(file => file.EndsWith(".cs"))) { filteredMutants = ResetMutantStatusForChangedTests(mutants); } @@ -85,22 +65,24 @@ public IEnumerable FilterMutants(IEnumerable mutants, IReadOnlyF private void LogChangedFiles(StrykerOptions options) { - if (_diffResult != null && !options.BaselineRecreateEnabled) + if (_diffResult != null && !options.RecreateBaseline) { - _logger.LogInformation("{0} files changed", (_diffResult.ChangedSourceFiles?.Count ?? 0) + (_diffResult.ChangedTestFiles?.Count ?? 0)); + _logger.LogInformation("{ChangedFilesCount} files changed", (_diffResult.ChangedSourceFiles?.Count ?? 0) + (_diffResult.ChangedTestFiles?.Count ?? 0)); if (_diffResult.ChangedSourceFiles != null) { + _logger.LogInformation("{ChangedFilesCount} source files changed", _diffResult.ChangedSourceFiles.Count); foreach (var changedFile in _diffResult.ChangedSourceFiles) { - _logger.LogInformation("Changed file {0}", changedFile); + _logger.LogDebug("Changed file {ChangedFile}", changedFile); } } if (_diffResult.ChangedTestFiles != null) { + _logger.LogInformation("{ChangedFilesCount} test files changed", _diffResult.ChangedTestFiles.Count); foreach (var changedFile in _diffResult.ChangedTestFiles) { - _logger.LogInformation("Changed test file {0}", changedFile); + _logger.LogDebug("Changed test file {ChangedFile}", changedFile); } } } diff --git a/src/Stryker.Core/Stryker.Core/Options/Inputs/ProjectVersionInput.cs b/src/Stryker.Core/Stryker.Core/Options/Inputs/ProjectVersionInput.cs index 57f47edec9..f75b0bd829 100644 --- a/src/Stryker.Core/Stryker.Core/Options/Inputs/ProjectVersionInput.cs +++ b/src/Stryker.Core/Stryker.Core/Options/Inputs/ProjectVersionInput.cs @@ -17,7 +17,7 @@ public string Validate(IEnumerable reporters, bool baselineEnabled) { if (baselineEnabled && string.IsNullOrWhiteSpace(SuppliedInput)) { - throw new InputException("Project version cannot be empty when baseline is enabled"); + throw new InputException("Project version cannot be empty when baseline is enabled."); } return SuppliedInput ?? Default; } diff --git a/src/Stryker.Core/Stryker.Core/Options/StrykerInputs.cs b/src/Stryker.Core/Stryker.Core/Options/StrykerInputs.cs index d907a20db1..2a7a843d77 100644 --- a/src/Stryker.Core/Stryker.Core/Options/StrykerInputs.cs +++ b/src/Stryker.Core/Stryker.Core/Options/StrykerInputs.cs @@ -165,7 +165,7 @@ public StrykerOptions ValidateAll() DiffIgnoreChanges = DiffIgnoreChangesInput.Validate(), AzureFileStorageSas = AzureFileStorageSasInput.Validate(baselineProvider, baselineEnabled), AzureFileStorageUrl = AzureFileStorageUrlInput.Validate(baselineProvider, baselineEnabled), - BaselineRecreateEnabled = baselineRecreateEnabled, + RecreateBaseline = baselineRecreateEnabled, BaselineEnabled = baselineEnabled, BaselineProvider = baselineProvider, FallbackVersion = FallbackVersionInput.Validate(baselineEnabled, sinceTarget), diff --git a/src/Stryker.Core/Stryker.Core/Options/StrykerOptions.cs b/src/Stryker.Core/Stryker.Core/Options/StrykerOptions.cs index effd647543..548829c51b 100644 --- a/src/Stryker.Core/Stryker.Core/Options/StrykerOptions.cs +++ b/src/Stryker.Core/Stryker.Core/Options/StrykerOptions.cs @@ -121,15 +121,15 @@ public class StrykerOptions /// public IEnumerable Reporters { get; init; } = []; - /// - /// When true, a new baseline should be created. - /// - public bool BaselineRecreateEnabled { get; init; } - - /// - /// When true, the baseline feature should be enabled. - /// - public bool BaselineEnabled { get; init; } + /// + /// When true, a new baseline should be created. + /// + public bool RecreateBaseline { get; init; } + + /// + /// When true, the baseline feature should be enabled. + /// + public bool BaselineEnabled { get; init; } /// /// When the baseline feature is enabled, this selects the source of the baseline.