Skip to content

Comments

fix: update Core public API snapshots for all frameworks#4957

Merged
thomhurst merged 2 commits intomainfrom
fix/update-public-api-snapshots
Feb 19, 2026
Merged

fix: update Core public API snapshots for all frameworks#4957
thomhurst merged 2 commits intomainfrom
fix/update-public-api-snapshots

Conversation

@thomhurst
Copy link
Owner

Summary

Test plan

  • dotnet test --project TUnit.PublicAPI --framework net8.0 passes
  • dotnet test --project TUnit.PublicAPI --framework net9.0 passes
  • dotnet test --project TUnit.PublicAPI --framework net10.0 passes

The merged PRs #4929 (hardcoded constants) and #4949 (retry policies)
added new public API surface to TUnit.Core but the DotNet8_0, DotNet9_0,
and DotNet10_0 verified snapshot files were not updated, causing
Core_Library_Has_No_API_Changes test failures in all PR CI pipelines.
@claude
Copy link
Contributor

claude bot commented Feb 19, 2026

Code Review

Issue found: Tests.Core_Library_Has_No_API_Changes.Net4_7.verified.txt not updated

This PR fixes the snapshot test failures for DotNet8_0, DotNet9_0, and DotNet10_0, but the Net4_7 verified snapshot was not updated — meaning the Windows CI pipeline will still fail for this test.

Why it matters:

RunPublicAPITestsModule extends TestBaseModule without overriding TestableFrameworks. The base implementation yields "net472" on Windows:

// TUnit.Pipeline/Modules/Abstract/TestBaseModule.cs:22
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
    yield return "net472";
}

Since ExecuteAsync iterates over all TestableFrameworks, the public API test runs against the net472 target on Windows CI.

The Net4_7.verified.txt snapshot is currently missing all new API members:

Checked against the source files — none of the new code has #if conditional compilation guards, so these APIs are compiled into the netstandard2.0 target (used by net472) as well. The following are absent from Tests.Core_Library_Has_No_API_Changes.Net4_7.verified.txt:

  • New public static class Defaults with ForcefulExitTimeout, HookTimeout, ProcessExitHookDelay, TestTimeout
  • public void SetRetryBackoff(int backoffMs, double backoffMultiplier) on DiscoveredTestContext
  • public int BackoffMs { get; set; }, public double BackoffMultiplier { get; set; }, public Type[]? RetryOnExceptionTypes { get; set; } on RetryAttribute
  • public int RetryBackoffMs { get; set; }, public double RetryBackoffMultiplier { get; set; } on TestDetails
  • int RetryBackoffMs { get; }, double RetryBackoffMultiplier { get; } on ITestConfiguration

Fix: Run the public API tests on net472 locally (Windows only) and accept the .received.txt output as the new .verified.txt, or manually mirror the same additions made to the other three snapshot files into Tests.Core_Library_Has_No_API_Changes.Net4_7.verified.txt.

PR #4956 changed the CancellationTokenMustBeLastParameter diagnostic
to point at the CancellationToken parameter instead of the method name.
Update 3 test expectations to match the new diagnostic location.
@thomhurst thomhurst merged commit 86249de into main Feb 19, 2026
12 of 14 checks passed
@thomhurst thomhurst deleted the fix/update-public-api-snapshots branch February 19, 2026 11:45
This was referenced Feb 22, 2026
This was referenced Feb 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant