Skip to content

chore(mocks): regenerate source generator snapshots#5691

Merged
thomhurst merged 1 commit intomainfrom
chore/regen-mock-snapshots
Apr 24, 2026
Merged

chore(mocks): regenerate source generator snapshots#5691
thomhurst merged 1 commit intomainfrom
chore/regen-mock-snapshots

Conversation

@thomhurst
Copy link
Copy Markdown
Owner

Summary

Regenerate the TUnit.Mocks source-generator snapshot baselines to match the current generator output after the recent mocks fixes (#5677 / #5678 / #5679 / #5680 / #5681 / #5682 / #5683 / #5684).

Changes

  • 1 snapshot file updated: Class_Implementing_Static_Abstract_Interface.verified.txt
  • The drift is a single-line addition of [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] on the generated mock constructor — directly matching the intent of [Bug] TUnit.Mocks: mocking a type with required members fails with CS9035 #5678 ("fix(mocks): emit [SetsRequiredMembers] on generated mock ctor").

Verification

  • Spot-checked the diff: legitimate generator output change, not a bug. Generated C# is well-formed.
  • Before regen: 48 passed / 1 failed (on net10.0).
  • After regen: 49 passed / 0 failed.

Test plan

  • dotnet build TUnit.Mocks.SourceGenerator.Tests/TUnit.Mocks.SourceGenerator.Tests.csproj
  • dotnet run --framework net10.0 --no-build in TUnit.Mocks.SourceGenerator.Tests/ — all 49 tests pass
  • Only .verified.txt files touched; no .received.txt committed

Bring committed .verified.txt baselines in line with the current mock
source generator output (post #5677-#5684 fixes).
@thomhurst thomhurst merged commit b6c08bd into main Apr 24, 2026
12 of 14 checks passed
Copy link
Copy Markdown
Contributor

@claude claude Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

Summary: Single-line snapshot baseline update adding [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] to the generated mock constructor for StaticAbstractImplMockImpl.

Change Analysis

The addition is correct and appropriate. [SetsRequiredMembers] is needed on constructors that satisfy required member initialization, so consumers don't need to use object-initializer syntax to set required properties after construction. This directly matches the intent of #5678.

Scope check: The PR description notes 48/1 → 49/0 (before/after), which confirms this was the sole failing snapshot. No other baselines were missed — classes without required members correctly don't carry this attribute on their constructors.

Convention compliance:

  • ✅ Only .verified.txt touched — no .received.txt committed (per project rules)
  • ✅ Snapshot accepted rather than suppressed or worked around
  • ✅ Commit message follows chore(mocks): convention

No issues found. This is a clean, minimal, and purposeful snapshot baseline update that properly closes the test regression introduced by the mocks fixes in #5677#5684. Good work keeping the baselines tight and not over-regenerating unrelated snapshots.

@thomhurst thomhurst deleted the chore/regen-mock-snapshots branch April 24, 2026 01:03
@codacy-production
Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@thomhurst
Copy link
Copy Markdown
Owner Author

The windows-latest modularpipeline failure on this PR is unrelated to this PR's changes (which only regenerate one .verified.txt snapshot file).

Root cause

TUnit.Assertions.Tests.ExecutionTimeTests.Completes_Within_Unhappy (net8.0) failed with a flaky timing assertion:

AssertionException: Expected to be less than 00:00:01
but received 00:00:02.3657737
  at Assert.That(duration).IsLessThan(TimeSpan.FromSeconds(1))
  at TUnit.Assertions.Tests.ExecutionTimeTests.Completes_Within_Unhappy() in ExecutionTimeTests.cs:30

The test launches an action that calls Thread.Sleep(10000), asserts a 250ms timeout fires as expected, then asserts the total stopwatch elapsed is < 1 second. On a slow/contended Windows runner, cleanup from the sleeping thread (or CI scheduling jitter) can exceed 1s. This is a pre-existing flaky test, not introduced by this PR.

Evidence it is pre-existing

The most recent main run (24864304955) also failed its modularpipeline jobs. On main, all three OS runners fail RunMockSourceGeneratorTestsModule on the Class_Implementing_Static_Abstract_Interface snapshot — which is exactly what this PR fixes. On this PR, the RunMockSourceGeneratorTestsModule step passes on every OS, and only windows-latest hit the unrelated flake.

Recommendation

This PR can be merged as-is. The Completes_Within_Unhappy test should be loosened (or re-run on failure) in a follow-up.

This was referenced Apr 24, 2026
intellitect-bot pushed a commit to IntelliTect/EssentialCSharp.Web that referenced this pull request Apr 25, 2026
Updated [TUnit](https://github.com/thomhurst/TUnit) from 1.37.10 to
1.39.0.

<details>
<summary>Release notes</summary>

_Sourced from [TUnit's
releases](https://github.com/thomhurst/TUnit/releases)._

## 1.39.0

<!-- Release notes generated using configuration in .github/release.yml
at v1.39.0 -->

## What's Changed
### Other Changes
* perf(mocks): shrink MethodSetup + cache stateless matchers by
@​thomhurst in thomhurst/TUnit#5669
* fix(mocks): handle base classes with explicit interface impls (#​5673)
by @​thomhurst in thomhurst/TUnit#5674
* fix(mocks): implement indexer in generated mock (#​5676) by
@​thomhurst in thomhurst/TUnit#5683
* fix(mocks): disambiguate IEquatable<T>.Equals from object.Equals
(#​5675) by @​thomhurst in thomhurst/TUnit#5680
* fix(mocks): escape C# keyword identifiers at all emit sites (#​5679)
by @​thomhurst in thomhurst/TUnit#5684
* fix(mocks): emit [SetsRequiredMembers] on generated mock ctor (#​5678)
by @​thomhurst in thomhurst/TUnit#5682
* fix(mocks): skip MockBridge for class targets with static-abstract
interfaces (#​5677) by @​thomhurst in
thomhurst/TUnit#5681
* chore(mocks): regenerate source generator snapshots by @​thomhurst in
thomhurst/TUnit#5691
* perf(engine): collapse async state-machine layers on hot test path
(#​5687) by @​thomhurst in thomhurst/TUnit#5690
* perf(engine): reduce lock contention in scheduling and hook caches
(#​5686) by @​thomhurst in thomhurst/TUnit#5693
* fix(assertions): prevent implicit-to-string op from NREing on null
(#​5692) by @​thomhurst in thomhurst/TUnit#5696
* perf(engine/core): reduce per-test allocations (#​5688) by @​thomhurst
in thomhurst/TUnit#5694
* perf(engine): reduce message-bus contention on test start (#​5685) by
@​thomhurst in thomhurst/TUnit#5695
### Dependencies
* chore(deps): update tunit to 1.37.36 by @​thomhurst in
thomhurst/TUnit#5667
* chore(deps): update verify to 31.16.2 by @​thomhurst in
thomhurst/TUnit#5699


**Full Changelog**:
thomhurst/TUnit@v1.37.36...v1.39.0

## 1.37.36

<!-- Release notes generated using configuration in .github/release.yml
at v1.37.36 -->

## What's Changed
### Other Changes
* fix(telemetry): remove duplicate HTTP client spans by @​thomhurst in
thomhurst/TUnit#5668


**Full Changelog**:
thomhurst/TUnit@v1.37.35...v1.37.36

## 1.37.35

<!-- Release notes generated using configuration in .github/release.yml
at v1.37.35 -->

## What's Changed
### Other Changes
* Add TUnit.TestProject.Library to the TUnit.Dev.slnx solution file by
@​Zodt in thomhurst/TUnit#5655
* fix(aspire): preserve user-supplied OTLP endpoint (#​4818) by
@​thomhurst in thomhurst/TUnit#5665
* feat(aspire): emit client spans for HTTP by @​thomhurst in
thomhurst/TUnit#5666
### Dependencies
* chore(deps): update dependency dotnet-sdk to v10.0.203 by @​thomhurst
in thomhurst/TUnit#5656
* chore(deps): update microsoft.aspnetcore to 10.0.7 by @​thomhurst in
thomhurst/TUnit#5657
* chore(deps): update tunit to 1.37.24 by @​thomhurst in
thomhurst/TUnit#5659
* chore(deps): update microsoft.extensions to 10.0.7 by @​thomhurst in
thomhurst/TUnit#5658
* chore(deps): update aspire to 13.2.3 by @​thomhurst in
thomhurst/TUnit#5661
* chore(deps): update dependency microsoft.net.test.sdk to 18.5.0 by
@​thomhurst in thomhurst/TUnit#5664

## New Contributors
* @​Zodt made their first contribution in
thomhurst/TUnit#5655

**Full Changelog**:
thomhurst/TUnit@v1.37.24...v1.37.35

## 1.37.24

<!-- Release notes generated using configuration in .github/release.yml
at v1.37.24 -->

## What's Changed
### Other Changes
* docs: add Tluma Ask AI widget to Docusaurus site by @​thomhurst in
thomhurst/TUnit#5638
* Revert "chore(deps): update dependency docusaurus-plugin-llms to
^0.4.0 (#​5637)" by @​thomhurst in
thomhurst/TUnit#5640
* fix(asp-net): forward disposal in FlowSuppressingHostedService
(#​5651) by @​JohnVerheij in
thomhurst/TUnit#5652
### Dependencies
* chore(deps): update dependency docusaurus-plugin-llms to ^0.4.0 by
@​thomhurst in thomhurst/TUnit#5637
* chore(deps): update tunit to 1.37.10 by @​thomhurst in
thomhurst/TUnit#5639
* chore(deps): update opentelemetry to 1.15.3 by @​thomhurst in
thomhurst/TUnit#5645
* chore(deps): update opentelemetry by @​thomhurst in
thomhurst/TUnit#5647
* chore(deps): update dependency dompurify to v3.4.1 by @​thomhurst in
thomhurst/TUnit#5648
* chore(deps): update dependency system.commandline to 2.0.7 by
@​thomhurst in thomhurst/TUnit#5650
* chore(deps): update dependency microsoft.entityframeworkcore to 10.0.7
by @​thomhurst in thomhurst/TUnit#5649
* chore(deps): update dependency microsoft.templateengine.authoring.cli
to v10.0.203 by @​thomhurst in
thomhurst/TUnit#5653
* chore(deps): update dependency
microsoft.templateengine.authoring.templateverifier to 10.0.203 by
@​thomhurst in thomhurst/TUnit#5654


**Full Changelog**:
thomhurst/TUnit@v1.37.10...v1.37.24

Commits viewable in [compare
view](thomhurst/TUnit@v1.37.10...v1.39.0).
</details>

[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=TUnit&package-manager=nuget&previous-version=1.37.10&new-version=1.39.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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