From 075f3ff1a580c193b102914506ef3e976c08901d Mon Sep 17 00:00:00 2001 From: Brad Wilson Date: Sat, 27 Apr 2024 10:45:49 -0700 Subject: [PATCH 1/6] Bump up to 2.8.1-pre --- version.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.json b/version.json index b537248..42652df 100644 --- a/version.json +++ b/version.json @@ -1,6 +1,6 @@ { "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", - "version": "2.8.0", + "version": "2.8.1-pre.{height}", "nuGetPackageVersion": { "semVer": 2.0 }, From 06087e36a22182f5e44e508aaff4a25e3fa329e7 Mon Sep 17 00:00:00 2001 From: Brad Wilson Date: Sun, 5 May 2024 18:03:45 -0700 Subject: [PATCH 2/6] Latest actions versions --- .github/workflows/pull-request.yaml | 9 +++++---- .github/workflows/push-main.yaml | 12 +++++++----- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.github/workflows/pull-request.yaml b/.github/workflows/pull-request.yaml index 8e1c74e..cf1a3f7 100644 --- a/.github/workflows/pull-request.yaml +++ b/.github/workflows/pull-request.yaml @@ -11,20 +11,20 @@ jobs: DOTNET_NOLOGO: true steps: - name: Clone source - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 submodules: true - name: Add MSBuild to PATH - uses: microsoft/setup-msbuild@v1 + uses: microsoft/setup-msbuild@v2 - name: Replace global.json run: cp .github/workflows/.global.json global.json shell: bash - name: Install .NET SDK - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v4 with: dotnet-version: | 6.0.x @@ -37,8 +37,9 @@ jobs: run: dotnet run --project tools/builder --no-launch-profile -- BuildAll --timing - name: "Upload artifact: test" - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: test path: artifacts/test + compression-level: 9 if: always() diff --git a/.github/workflows/push-main.yaml b/.github/workflows/push-main.yaml index 713c893..1c14801 100644 --- a/.github/workflows/push-main.yaml +++ b/.github/workflows/push-main.yaml @@ -14,20 +14,20 @@ jobs: DOTNET_NOLOGO: true steps: - name: Clone source - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 submodules: true - name: Add MSBuild to PATH - uses: microsoft/setup-msbuild@v1 + uses: microsoft/setup-msbuild@v2 - name: Replace global.json run: cp .github/workflows/.global.json global.json shell: bash - name: Install .NET SDK - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v4 with: dotnet-version: | 6.0.x @@ -50,15 +50,17 @@ jobs: run: dotnet run --project tools/builder --no-launch-profile -- BuildAll PublishPackages --timing - name: "Upload artifact: test" - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: test path: artifacts/test + compression-level: 9 if: always() - name: "Upload artifact: packages" - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: packages path: artifacts/packages + compression-level: 0 if: always() From e2052445d878aaf8c6b2bed7437d1c990447e7a4 Mon Sep 17 00:00:00 2001 From: Brad Wilson Date: Fri, 10 May 2024 11:14:19 -0700 Subject: [PATCH 3/6] #408: Add ability to print live output messages --- Versions.props | 4 ++-- .../Sinks/VsExecutionSink.cs | 12 +++++++++++- src/xunit.runner.visualstudio/Utility/RunSettings.cs | 8 ++++++++ src/xunit.runner.visualstudio/VsTestRunner.cs | 2 +- .../RunSettingsTests.cs | 4 ++++ 5 files changed, 26 insertions(+), 4 deletions(-) diff --git a/Versions.props b/Versions.props index 0127713..ee4d2dc 100644 --- a/Versions.props +++ b/Versions.props @@ -8,8 +8,8 @@ 3.6.133 5.1.0 1.0.0-alpha.160 - 1.13.0 - 2.8.0 + 1.14.0-pre.3 + 2.8.1-pre.10 diff --git a/src/xunit.runner.visualstudio/Sinks/VsExecutionSink.cs b/src/xunit.runner.visualstudio/Sinks/VsExecutionSink.cs index 0732495..62460a0 100644 --- a/src/xunit.runner.visualstudio/Sinks/VsExecutionSink.cs +++ b/src/xunit.runner.visualstudio/Sinks/VsExecutionSink.cs @@ -22,7 +22,8 @@ public VsExecutionSink( ITestExecutionRecorder recorder, LoggerHelper logger, Dictionary testCasesMap, - Func cancelledThunk) + Func cancelledThunk, + bool showLiveOutput) { this.innerSink = innerSink; this.recorder = recorder; @@ -45,6 +46,9 @@ public VsExecutionSink( Execution.TestMethodCleanupFailureEvent += HandleTestMethodCleanupFailure; Execution.TestPassedEvent += HandleTestPassed; Execution.TestSkippedEvent += HandleTestSkipped; + + if (showLiveOutput) + Execution.TestOutputEvent += HandleTestOutput; } public ExecutionSummary ExecutionSummary { get; private set; } @@ -127,6 +131,12 @@ void HandleTestFailed(MessageHandlerArgs args) HandleCancellation(args); } + void HandleTestOutput(MessageHandlerArgs args) + { + var testOutput = args.Message; + logger.Log(" {0} [OUTPUT] {1}", testOutput.Test.DisplayName, testOutput.Output.TrimEnd()); + } + void HandleTestPassed(MessageHandlerArgs args) { var testPassed = args.Message; diff --git a/src/xunit.runner.visualstudio/Utility/RunSettings.cs b/src/xunit.runner.visualstudio/Utility/RunSettings.cs index 611de93..604fcaf 100644 --- a/src/xunit.runner.visualstudio/Utility/RunSettings.cs +++ b/src/xunit.runner.visualstudio/Utility/RunSettings.cs @@ -23,6 +23,7 @@ public class RunSettings public bool? PreEnumerateTheories { get; set; } public string? ReporterSwitch { get; set; } public bool? ShadowCopy { get; set; } + public bool? ShowLiveOutput { get; set; } public bool? StopOnFail { get; set; } public string? TargetFrameworkVersion { get; set; } @@ -54,6 +55,8 @@ public void CopyTo(TestAssemblyConfiguration configuration) configuration.PreEnumerateTheories = PreEnumerateTheories; if (ShadowCopy.HasValue) configuration.ShadowCopy = ShadowCopy; + if (ShowLiveOutput.HasValue) + configuration.ShowLiveOutput = ShowLiveOutput; if (StopOnFail.HasValue) configuration.StopOnFail = StopOnFail; } @@ -154,6 +157,10 @@ public static RunSettings Parse(string? settingsXml) if (bool.TryParse(shadowCopyString, out var shadowCopy)) result.ShadowCopy = shadowCopy; + var showLiveOutputString = xunitElement.Element(Constants.Xunit.ShowLiveOutput)?.Value; + if (bool.TryParse(showLiveOutputString, out var showLiveOutput)) + result.ShowLiveOutput = showLiveOutput; + var stopOnFailString = xunitElement.Element(Constants.Xunit.StopOnFail)?.Value; if (bool.TryParse(stopOnFailString, out var stopOnFail)) result.StopOnFail = stopOnFail; @@ -243,6 +250,7 @@ public static class Xunit public const string PreEnumerateTheories = "PreEnumerateTheories"; public const string ReporterSwitch = "ReporterSwitch"; public const string ShadowCopy = "ShadowCopy"; + public const string ShowLiveOutput = "ShowLiveOutput"; public const string StopOnFail = "StopOnFail"; } } diff --git a/src/xunit.runner.visualstudio/VsTestRunner.cs b/src/xunit.runner.visualstudio/VsTestRunner.cs index 79bf42d..903f966 100644 --- a/src/xunit.runner.visualstudio/VsTestRunner.cs +++ b/src/xunit.runner.visualstudio/VsTestRunner.cs @@ -543,7 +543,7 @@ void RunTestsInAssembly( reporterMessageHandler.OnMessage(new TestAssemblyExecutionStarting(runInfo.Assembly, executionOptions)); - using var vsExecutionSink = new VsExecutionSink(reporterMessageHandler, frameworkHandle, logger, testCasesMap, () => cancelled); + using var vsExecutionSink = new VsExecutionSink(reporterMessageHandler, frameworkHandle, logger, testCasesMap, () => cancelled, executionOptions.GetShowLiveOutputOrDefault()); var executionSinkOptions = new ExecutionSinkOptions { DiagnosticMessageSink = diagnosticsSinkRemote, diff --git a/test/test.xunit.runner.visualstudio/RunSettingsTests.cs b/test/test.xunit.runner.visualstudio/RunSettingsTests.cs index 60126e0..7041f9e 100644 --- a/test/test.xunit.runner.visualstudio/RunSettingsTests.cs +++ b/test/test.xunit.runner.visualstudio/RunSettingsTests.cs @@ -1,5 +1,6 @@ using System; using Xunit; +using Xunit.Abstractions; using Xunit.Runner.VisualStudio; public class RunSettingsTests @@ -23,6 +24,7 @@ void AssertDefaultValues(RunSettings runSettings) Assert.Null(runSettings.PreEnumerateTheories); Assert.Null(runSettings.ReporterSwitch); Assert.Null(runSettings.ShadowCopy); + Assert.Null(runSettings.ShowLiveOutput); Assert.Null(runSettings.StopOnFail); Assert.Null(runSettings.TargetFrameworkVersion); } @@ -123,6 +125,7 @@ public void RunSettingsHelperShouldReadBooleanValuesCorrectly(bool testValue) {testValueString} {testValueString} {testValueString} + {testValueString} {testValueString} "; @@ -140,6 +143,7 @@ public void RunSettingsHelperShouldReadBooleanValuesCorrectly(bool testValue) Assert.Equal(testValue, runSettings.ParallelizeTestCollections); Assert.Equal(testValue, runSettings.PreEnumerateTheories); Assert.Equal(testValue, runSettings.ShadowCopy); + Assert.Equal(testValue, runSettings.ShowLiveOutput); Assert.Equal(testValue, runSettings.StopOnFail); } From 45eb7838531b6b94ee30c823ea59be48c483da6c Mon Sep 17 00:00:00 2001 From: Brad Wilson Date: Fri, 10 May 2024 12:27:21 -0700 Subject: [PATCH 4/6] Pull in output printing bug fix from core --- Versions.props | 2 +- .../Sinks/VsExecutionSink.cs | 12 +----------- src/xunit.runner.visualstudio/VsTestRunner.cs | 2 +- test/xunit.runner.json | 6 ++---- 4 files changed, 5 insertions(+), 17 deletions(-) diff --git a/Versions.props b/Versions.props index ee4d2dc..97f8b65 100644 --- a/Versions.props +++ b/Versions.props @@ -9,7 +9,7 @@ 5.1.0 1.0.0-alpha.160 1.14.0-pre.3 - 2.8.1-pre.10 + 2.8.1-pre.11 diff --git a/src/xunit.runner.visualstudio/Sinks/VsExecutionSink.cs b/src/xunit.runner.visualstudio/Sinks/VsExecutionSink.cs index 62460a0..0732495 100644 --- a/src/xunit.runner.visualstudio/Sinks/VsExecutionSink.cs +++ b/src/xunit.runner.visualstudio/Sinks/VsExecutionSink.cs @@ -22,8 +22,7 @@ public VsExecutionSink( ITestExecutionRecorder recorder, LoggerHelper logger, Dictionary testCasesMap, - Func cancelledThunk, - bool showLiveOutput) + Func cancelledThunk) { this.innerSink = innerSink; this.recorder = recorder; @@ -46,9 +45,6 @@ public VsExecutionSink( Execution.TestMethodCleanupFailureEvent += HandleTestMethodCleanupFailure; Execution.TestPassedEvent += HandleTestPassed; Execution.TestSkippedEvent += HandleTestSkipped; - - if (showLiveOutput) - Execution.TestOutputEvent += HandleTestOutput; } public ExecutionSummary ExecutionSummary { get; private set; } @@ -131,12 +127,6 @@ void HandleTestFailed(MessageHandlerArgs args) HandleCancellation(args); } - void HandleTestOutput(MessageHandlerArgs args) - { - var testOutput = args.Message; - logger.Log(" {0} [OUTPUT] {1}", testOutput.Test.DisplayName, testOutput.Output.TrimEnd()); - } - void HandleTestPassed(MessageHandlerArgs args) { var testPassed = args.Message; diff --git a/src/xunit.runner.visualstudio/VsTestRunner.cs b/src/xunit.runner.visualstudio/VsTestRunner.cs index 903f966..79bf42d 100644 --- a/src/xunit.runner.visualstudio/VsTestRunner.cs +++ b/src/xunit.runner.visualstudio/VsTestRunner.cs @@ -543,7 +543,7 @@ void RunTestsInAssembly( reporterMessageHandler.OnMessage(new TestAssemblyExecutionStarting(runInfo.Assembly, executionOptions)); - using var vsExecutionSink = new VsExecutionSink(reporterMessageHandler, frameworkHandle, logger, testCasesMap, () => cancelled, executionOptions.GetShowLiveOutputOrDefault()); + using var vsExecutionSink = new VsExecutionSink(reporterMessageHandler, frameworkHandle, logger, testCasesMap, () => cancelled); var executionSinkOptions = new ExecutionSinkOptions { DiagnosticMessageSink = diagnosticsSinkRemote, diff --git a/test/xunit.runner.json b/test/xunit.runner.json index 18ac72b..5bb2ed0 100644 --- a/test/xunit.runner.json +++ b/test/xunit.runner.json @@ -1,6 +1,4 @@ { - "$schema": "https://xunit.net/schema/v2.5/xunit.runner.schema.json", - "diagnosticMessages": true, - "methodDisplay": "classAndMethod", - "parallelizeAssembly": true + "$schema": "https://xunit.net/schema/v2.8.1/xunit.runner.schema.json", + "diagnosticMessages": true } From 3656cb8908b70944c230439c1e879645d2fce05e Mon Sep 17 00:00:00 2001 From: Brad Wilson Date: Thu, 23 May 2024 17:48:34 -0700 Subject: [PATCH 5/6] Use 'dotnet format' instead of 'dotnet dotnet-format' --- .config/dotnet-tools.json | 6 ------ tools/builder/common | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index eca4255..0cca1dc 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -2,12 +2,6 @@ "version": 1, "isRoot": true, "tools": { - "dotnet-format": { - "version": "5.1.250801", - "commands": [ - "dotnet-format" - ] - }, "sign": { "version": "0.9.1-beta.23203.3", "commands": [ diff --git a/tools/builder/common b/tools/builder/common index f14b9b2..e8305eb 160000 --- a/tools/builder/common +++ b/tools/builder/common @@ -1 +1 @@ -Subproject commit f14b9b23dc65a5eaa94b5c9a90cf4f107f64d46b +Subproject commit e8305ebba18fd42d26e6dff4beb7523d1acd2a6f From ce9211e9707372687c3266984a0950f6206b4896 Mon Sep 17 00:00:00 2001 From: Brad Wilson Date: Fri, 24 May 2024 20:12:22 -0700 Subject: [PATCH 6/6] v2.8.1 --- Versions.props | 6 +++--- version.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Versions.props b/Versions.props index 97f8b65..373103b 100644 --- a/Versions.props +++ b/Versions.props @@ -2,14 +2,14 @@ 6.0.11 - 17.9.0 + 17.10.0 8.0.0 $(MicrosoftNetTestSdkVersion) 3.6.133 5.1.0 1.0.0-alpha.160 - 1.14.0-pre.3 - 2.8.1-pre.11 + 1.14.0 + 2.8.1 diff --git a/version.json b/version.json index 42652df..c050439 100644 --- a/version.json +++ b/version.json @@ -1,6 +1,6 @@ { "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", - "version": "2.8.1-pre.{height}", + "version": "2.8.1", "nuGetPackageVersion": { "semVer": 2.0 },