Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@
<PackageVersion Include="Microsoft.Playwright" Version="1.58.0" />
<PackageVersion Include="Microsoft.TemplateEngine.Authoring.TemplateVerifier" Version="10.0.102" />
<PackageVersion Include="Microsoft.Testing.Extensions.CodeCoverage" Version="18.4.1" />
<PackageVersion Include="Microsoft.Testing.Extensions.CrashDump" Version="2.0.2" />
<PackageVersion Include="Microsoft.Testing.Extensions.HangDump" Version="2.0.2" />
<PackageVersion Include="Microsoft.Testing.Extensions.Telemetry" Version="2.0.2" />
<PackageVersion Include="Microsoft.Testing.Extensions.TrxReport" Version="2.0.2" />
<PackageVersion Include="Microsoft.Testing.Extensions.TrxReport.Abstractions" Version="2.0.2" />
<PackageVersion Include="Microsoft.Testing.Platform" Version="2.0.2" />
<PackageVersion Include="Microsoft.Testing.Platform.MSBuild" Version="2.0.2" />
<PackageVersion Include="Microsoft.Testing.Extensions.CrashDump" Version="2.1.0" />
<PackageVersion Include="Microsoft.Testing.Extensions.HangDump" Version="2.1.0" />
<PackageVersion Include="Microsoft.Testing.Extensions.Telemetry" Version="2.1.0" />
<PackageVersion Include="Microsoft.Testing.Extensions.TrxReport" Version="2.1.0" />
<PackageVersion Include="Microsoft.Testing.Extensions.TrxReport.Abstractions" Version="2.1.0" />
<PackageVersion Include="Microsoft.Testing.Platform" Version="2.1.0" />
<PackageVersion Include="Microsoft.Testing.Platform.MSBuild" Version="2.1.0" />
<PackageVersion Include="System.Threading.Channels" Version="9.0.0" />
<PackageVersion Include="ModularPipelines.DotNet" Version="3.1.6" />
<PackageVersion Include="ModularPipelines.Git" Version="3.1.6" />
Expand Down
8 changes: 8 additions & 0 deletions TUnit.Engine/Reporters/GitHubReporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,10 @@ public Task AfterRunAsync(int exitCode, CancellationToken cancellation)
x.Value.TestNode.Properties.AsEnumerable()
.Any(p => p is FailedTestNodeStateProperty or ErrorTestNodeStateProperty)).ToArray();

#pragma warning disable CS0618 // CancelledTestNodeStateProperty is obsolete
var cancelled = last.Where(x =>
x.Value.TestNode.Properties.AsEnumerable().Any(p => p is CancelledTestNodeStateProperty)).ToArray();
#pragma warning restore CS0618

var timeout = last
.Where(x => x.Value.TestNode.Properties.AsEnumerable().Any(p => p is TimeoutTestNodeStateProperty))
Expand Down Expand Up @@ -284,10 +286,12 @@ private static bool IsFileLocked(IOException exception)

private string GetDetails(IProperty? stateProperty, PropertyBag properties)
{
#pragma warning disable CS0618 // CancelledTestNodeStateProperty is obsolete
if (stateProperty is FailedTestNodeStateProperty
or ErrorTestNodeStateProperty
or TimeoutTestNodeStateProperty
or CancelledTestNodeStateProperty)
#pragma warning restore CS0618
{
return $"<pre>{GetError(stateProperty)}</pre>";
}
Expand Down Expand Up @@ -316,7 +320,9 @@ or TimeoutTestNodeStateProperty
ErrorTestNodeStateProperty errorTestNodeStateProperty =>
errorTestNodeStateProperty.Exception?.ToString() ?? "Test failed",
TimeoutTestNodeStateProperty timeoutTestNodeStateProperty => timeoutTestNodeStateProperty.Explanation,
#pragma warning disable CS0618 // CancelledTestNodeStateProperty is obsolete
CancelledTestNodeStateProperty => "Test was cancelled",
#pragma warning restore CS0618
_ => null
};
}
Expand All @@ -325,7 +331,9 @@ private static string GetStatus(IProperty? stateProperty)
{
return stateProperty switch
{
#pragma warning disable CS0618 // CancelledTestNodeStateProperty is obsolete
CancelledTestNodeStateProperty => "Cancelled",
#pragma warning restore CS0618
ErrorTestNodeStateProperty => "Failed",
FailedTestNodeStateProperty => "Failed",
InProgressTestNodeStateProperty => "In Progress (never finished)",
Expand Down
2 changes: 2 additions & 0 deletions TUnit.Engine/TUnitMessageBus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ public ValueTask Skipped(TestContext testContext, string reason)

public ValueTask Cancelled(TestContext testContext, DateTimeOffset start)
{
#pragma warning disable CS0618 // CancelledTestNodeStateProperty is obsolete - TUnit still needs to report cancelled state for its own reporters
var testNode = testContext.ToTestNode(new CancelledTestNodeStateProperty());
#pragma warning restore CS0618

return new ValueTask(context.MessageBus.PublishAsync(this, new TestNodeUpdateMessage(
sessionUid: _sessionSessionUid,
Expand Down
4 changes: 4 additions & 0 deletions TUnit.Engine/Xml/JUnitXmlWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,9 @@ private static void WriteTestCase(XmlWriter writer, TestNodeUpdateMessage test)
WriteTimeoutError(writer, timeout);
break;

#pragma warning disable CS0618 // CancelledTestNodeStateProperty is obsolete
case CancelledTestNodeStateProperty:
#pragma warning restore CS0618
WriteCancellationError(writer);
break;

Expand Down Expand Up @@ -357,7 +359,9 @@ private static TestSummary CalculateSummary(IEnumerable<TestNodeUpdateMessage> t
break;
case ErrorTestNodeStateProperty:
case TimeoutTestNodeStateProperty:
#pragma warning disable CS0618 // CancelledTestNodeStateProperty is obsolete
case CancelledTestNodeStateProperty:
#pragma warning restore CS0618
case InProgressTestNodeStateProperty:
summary.Errors++;
break;
Expand Down
Loading