Skip to content

Replace Verify with in-house generator snapshot assertions - #150

Merged
jas88 merged 3 commits into
mainfrom
remove-verify
Oct 14, 2026
Merged

jas88 merged 3 commits into
mainfrom
remove-verify

Conversation

@jas88

@jas88 jas88 commented Oct 14, 2026 •

Copy link
Copy Markdown
Owner

Summary

Verify 33.x (pulled in by #149) adds a SponsorCheck build gate that fails the build (SC021) unless a sponsorship/licence MSBuild property is declared. Verify was only used by the 14 source generator snapshot tests, so this replaces it with a small in-house helper and drops the dependency.

  • Add GeneratorSnapshot, which compares each generated source against the existing {Class}.{Test}#{HintName}.verified.cs files (unchanged), writes .received.cs on mismatch, flags stale snapshots, and fails on generator diagnostics or exceptions
  • Exclude *.verified.cs / *.received.cs from compilation in both test projects (previously done by Verify's MSBuild targets)
  • Remove Verify.NUnit / Verify.SourceGenerators and the Verify* Dependabot group pattern
  • Fix NativeCodecsTests.Initialize_WithEnableOptions_SetsProperties: enable options are applied before the native library is probed, so the library-unavailable branch asserted the wrong values (only reproducible where the native library is absent)

Testing

  • Solution builds with 0 warnings / 0 errors
  • Full test suite passes on net10.0 locally
  • Confirmed a deliberately altered snapshot fails with a clear message and writes a .received.cs file

After this merges, #149 only needs the NUnit 5 API fixes.


Summary by cubic

Verify 33.x adds a SponsorCheck build gate that fails the build unless a sponsorship MSBuild property is declared. Verify was only used for the 14 source generator snapshot tests, so this replaces it with a small in-house helper and drops the dependency.

  • Adds GeneratorSnapshot, which compares each generated source against the existing {Class}.{Test}#{HintName}.verified.cs files, writes .received.cs on mismatch, flags stale snapshots, and fails on generator diagnostics or exceptions.
  • Excludes *.verified.cs and *.received.cs from compilation in both test projects (previously handled by Verify's MSBuild targets).
  • Removes Verify.NUnit, Verify.SourceGenerators, and the Verify* Dependabot pattern.
  • Fixes NativeCodecsTests.Initialize_WithEnableOptions_SetsProperties: enable options are applied before the native library is probed, so the library-unavailable branch was asserting the wrong values.
  • Maps CI-recorded / _/ source paths back to the repository root, measured via a RepositoryRoot assembly metadata item, so snapshot files resolve in deterministic builds.

Written for commit fac71e3. Summary will update on new commits.

View guided diff Turn on auto-fix

jas88 added 2 commits October 13, 2026 19:53
Verify 33.x adds a SponsorCheck build gate that fails the build unless a
sponsorship/licence MSBuild property is declared. Verify was only used for
14 source generator snapshot tests, so replace it with a small helper.

- Add GeneratorSnapshot, which compares each generated source against the
  existing {Class}.{Test}#{HintName}.verified.cs files, writes .received.cs
  on mismatch, flags stale snapshots, and fails on generator diagnostics or
  exceptions
- Exclude *.verified.cs / *.received.cs from compilation (previously done
  by Verify's MSBuild targets)
- Remove Verify.NUnit and Verify.SourceGenerators packages and the
  dependabot group pattern
Enable options are applied before the native library is probed, so they
take effect even when the library is unavailable. The test asserted the
opposite in its library-unavailable branch, which CI never exercised.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No issues found across 9 files

View guided diff | Turn on auto-fix | Re-trigger cubic

Deterministic CI builds record CallerFilePath as /_/..., so snapshot files
could not be found. Embed the repository root as assembly metadata and map
/_/ paths back onto it.
@codecov

codecov Bot commented Oct 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.63%. Comparing base (3234de8) to head (fac71e3).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #150      +/-   ##
==========================================
- Coverage   65.64%   65.63%   -0.01%     
==========================================
  Files         337      337              
  Lines       30420    30420              
  Branches     5710     5710              
==========================================
- Hits        19970    19967       -3     
- Misses       9031     9034       +3     
  Partials     1419     1419              
Flag Coverage Δ
unittests 65.63% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jas88
jas88 merged commit 7886aed into main Oct 14, 2026
6 of 7 checks passed
@jas88
jas88 deleted the remove-verify branch October 14, 2026 01:25
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