Skip to content

test: bUnit update from 1.40.0 → 2.8.6 (latest stable) - #273

Merged
damyanpetev merged 2 commits into
masterfrom
dpetev/bunit-update
Jul 29, 2026
Merged

test: bUnit update from 1.40.0 → 2.8.6 (latest stable)#273
damyanpetev merged 2 commits into
masterfrom
dpetev/bunit-update

Conversation

@damyanpetev

Copy link
Copy Markdown
Member

bUnit is migrated from 1.40.0 → 2.8.6 (latest stable) per https://bunit.dev/docs/migrations/1to2.html, resolving the vulnerable dependency warning in old version.

What changed

PackageDirectory.Packages.props: bunit 1.40.0 → 2.8.6.
Mechanical v2 renames (across tests/IgniteUI.Blazor.Tests):

  • TestContextBunitContext (base class) — BlazorComponentTestBase.cs
  • RenderComponent<T>Render<T> (~230 call sites)
  • IRenderedFragmentIRenderedComponent<IComponent> — v2 removed the non-generic public interface; IRenderedComponent<out TComponent> is covariant, so <IComponent> is the correct non-generic scope handle

Non-mechanical fixes (v2 removed public API the harness relied on):

  1. Contract base constraint — ComponentWithContractTestBase.cs: where TComponent : IComponent where TComponent : class, IComponent. The covariant conversion IRenderedComponent<TComponent>IRenderedComponent<IComponent> only applies when the type arg is a reference type; Blazor components always are.
  2. ContractHost reworked to a context-thunkComponentContract.cs. v2 made ComponentParameterCollectionBuilder.Build() and the ComponentParameterCollection type internal, closing every public route to a detached host RenderFragment. Rather than reflect into internals (fragile), ContractHost.Of<THost> now returns Func<BunitContext, IRenderedComponent<IComponent>> = ctx => ctx.Render<THost>(arrange), deferring the render to the context. Followed the type through the two Getter hosted overloads, the Host property, treeHost in TreeTests, and the scope = method.Host(this) call site.

Doc — SKILL.md: TestContextBunitContext.

All three TFMs build clean and the full suite is green: 920 passed, 0 failed, 22 skipped on net8.0/net9.0/net10.0 (the 22 skips are pre-existing [Skip] attribute specs, untouched

One note: RenderComponent actually still exists in v2 as a compat alias, so that rename wasn't strictly required — but Render is the v2-idiomatic name, so the change is worth keeping.

@damyanpetev
damyanpetev requested review from MayaKirova and kdinev July 28, 2026 13:37
Base automatically changed from dpetev/interop-unit-tests to master July 28, 2026 15:38
Co-Authored-By: Claude  <noreply@anthropic.com>
@damyanpetev
damyanpetev force-pushed the dpetev/bunit-update branch from 8d40ac0 to 28663e6 Compare July 28, 2026 17:30
@damyanpetev damyanpetev added the dependencies Pull requests that update a dependency file label Jul 28, 2026
@damyanpetev
damyanpetev marked this pull request as ready for review July 28, 2026 17:30
Copilot AI review requested due to automatic review settings July 28, 2026 17:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Updates the test infrastructure in tests/IgniteUI.Blazor.Tests to bUnit v2, aligning the suite with the latest stable bUnit APIs and removing the vulnerable dependency warning tied to the older bUnit version.

Changes:

  • Bump bunit package version from 1.40.0 to 2.8.6.
  • Migrate tests to bUnit v2 idioms (TestContextBunitContext, RenderComponent<T>Render<T>).
  • Rework the contract-hosting test helper to avoid bUnit v2 internal APIs by deferring host rendering to the active test context and updating related interop harness types.

Reviewed changes

Copilot reviewed 60 out of 60 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/IgniteUI.Blazor.Tests/AlertTests.cs Updates component rendering calls to bUnit v2 Render<T>().
tests/IgniteUI.Blazor.Tests/AvatarTests.cs Updates component rendering calls to bUnit v2 Render<T>().
tests/IgniteUI.Blazor.Tests/BadgeExtendedTests.cs Updates component rendering calls to bUnit v2 Render<T>().
tests/IgniteUI.Blazor.Tests/BadgeTests.cs Updates component rendering calls to bUnit v2 Render<T>().
tests/IgniteUI.Blazor.Tests/BaseControlTests.cs Updates component rendering calls to bUnit v2 Render<T>().
tests/IgniteUI.Blazor.Tests/BlazorComponentTestBase.cs Switches base test context from TestContext to BunitContext.
tests/IgniteUI.Blazor.Tests/ButtonGroupTests.cs Updates component rendering calls to bUnit v2 Render<T>().
tests/IgniteUI.Blazor.Tests/ButtonTests.cs Updates component rendering calls to bUnit v2 Render<T>().
tests/IgniteUI.Blazor.Tests/CardTests.cs Updates component rendering calls to bUnit v2 Render<T>().
tests/IgniteUI.Blazor.Tests/CarouselTests.cs Updates component rendering calls to bUnit v2 Render<T>().
tests/IgniteUI.Blazor.Tests/ChatTests.cs Updates component rendering calls to bUnit v2 Render<T>().
tests/IgniteUI.Blazor.Tests/CheckboxTests.cs Updates component rendering calls to bUnit v2 Render<T>().
tests/IgniteUI.Blazor.Tests/ChipTests.cs Updates component rendering calls to bUnit v2 Render<T>().
tests/IgniteUI.Blazor.Tests/CircularGradientTests.cs Updates component rendering calls to bUnit v2 Render<T>().
tests/IgniteUI.Blazor.Tests/ComboTests.cs Updates contract helpers to use IRenderedComponent<IComponent> and bUnit v2 types.
tests/IgniteUI.Blazor.Tests/ComponentWithContractTestBase.cs Adjusts contract runner plumbing for bUnit v2 (host thunk + covariant rendered-component scope).
tests/IgniteUI.Blazor.Tests/DateTimeInputTests.cs Updates component rendering calls to bUnit v2 Render<T>().
tests/IgniteUI.Blazor.Tests/DialogExtendedTests.cs Updates component rendering calls to bUnit v2 Render<T>().
tests/IgniteUI.Blazor.Tests/DialogTests.cs Updates component rendering calls to bUnit v2 Render<T>().
tests/IgniteUI.Blazor.Tests/DropdownExtendedTests.cs Updates component rendering calls to bUnit v2 Render<T>().
tests/IgniteUI.Blazor.Tests/DropdownTests.cs Updates component rendering calls to bUnit v2 Render<T>().
tests/IgniteUI.Blazor.Tests/EnumSerializationTests.cs Updates component rendering calls to bUnit v2 Render<T>().
tests/IgniteUI.Blazor.Tests/ExpansionPanelTests.cs Updates component rendering calls to bUnit v2 Render<T>().
tests/IgniteUI.Blazor.Tests/HighlightTests.cs Updates component rendering calls to bUnit v2 Render<T>().
tests/IgniteUI.Blazor.Tests/IconButtonTests.cs Updates component rendering calls to bUnit v2 Render<T>().
tests/IgniteUI.Blazor.Tests/IconTests.cs Updates component rendering calls to bUnit v2 Render<T>().
tests/IgniteUI.Blazor.Tests/InputExtendedTests.cs Updates component rendering calls to bUnit v2 Render<T>().
tests/IgniteUI.Blazor.Tests/InputTests.cs Updates component rendering calls to bUnit v2 Render<T>().
tests/IgniteUI.Blazor.Tests/Interop/ComponentContract.cs Reworks ContractHost to return a context-based render thunk and updates hosted-spec types accordingly.
tests/IgniteUI.Blazor.Tests/Interop/InteropHarness.cs Updates harness APIs to use IRenderedComponent<IComponent> instead of removed IRenderedFragment.
tests/IgniteUI.Blazor.Tests/Interop/RendererMessageInteropHarness.cs Updates harness implementation signatures to match new rendered-component scope types.
tests/IgniteUI.Blazor.Tests/InteropEventTests.cs Updates component rendering calls to bUnit v2 Render<T>().
tests/IgniteUI.Blazor.Tests/InteropReadinessTests.cs Updates component rendering calls to bUnit v2 Render<T>().
tests/IgniteUI.Blazor.Tests/ListTests.cs Updates component rendering calls to bUnit v2 Render<T>().
tests/IgniteUI.Blazor.Tests/MethodInteropTests.cs Updates component rendering calls to bUnit v2 Render<T>().
tests/IgniteUI.Blazor.Tests/MiscComponentTests.cs Updates component rendering calls to bUnit v2 Render<T>().
tests/IgniteUI.Blazor.Tests/NavDrawerTests.cs Updates component rendering calls to bUnit v2 Render<T>().
tests/IgniteUI.Blazor.Tests/NavigationTests.cs Updates component rendering calls to bUnit v2 Render<T>().
tests/IgniteUI.Blazor.Tests/ProgressExtendedTests.cs Updates component rendering calls to bUnit v2 Render<T>().
tests/IgniteUI.Blazor.Tests/ProgressTests.cs Updates component rendering calls to bUnit v2 Render<T>().
tests/IgniteUI.Blazor.Tests/RadioTests.cs Updates component rendering calls to bUnit v2 Render<T>().
tests/IgniteUI.Blazor.Tests/RangeSliderTests.cs Updates component rendering calls to bUnit v2 Render<T>().
tests/IgniteUI.Blazor.Tests/RatingTests.cs Updates component rendering calls to bUnit v2 Render<T>().
tests/IgniteUI.Blazor.Tests/RenderingSerializationTests.cs Updates component rendering calls to bUnit v2 Render<T>().
tests/IgniteUI.Blazor.Tests/SelectExtendedTests.cs Updates component rendering calls to bUnit v2 Render<T>().
tests/IgniteUI.Blazor.Tests/SelectTests.cs Updates component rendering calls to bUnit v2 Render<T>().
tests/IgniteUI.Blazor.Tests/SliderExtendedTests.cs Updates component rendering calls to bUnit v2 Render<T>().
tests/IgniteUI.Blazor.Tests/SliderTests.cs Updates component rendering calls to bUnit v2 Render<T>().
tests/IgniteUI.Blazor.Tests/SplitterTests.cs Updates component rendering calls to bUnit v2 Render<T>().
tests/IgniteUI.Blazor.Tests/StepperTests.cs Updates component rendering calls to bUnit v2 Render<T>().
tests/IgniteUI.Blazor.Tests/SwitchTests.cs Updates component rendering calls to bUnit v2 Render<T>().
tests/IgniteUI.Blazor.Tests/TabsTests.cs Updates component rendering calls to bUnit v2 Render<T>().
tests/IgniteUI.Blazor.Tests/TextInputTests.cs Updates component rendering calls to bUnit v2 Render<T>().
tests/IgniteUI.Blazor.Tests/ThemeProviderTests.cs Updates component rendering calls to bUnit v2 Render<T>().
tests/IgniteUI.Blazor.Tests/TileManagerTests.cs Updates component rendering calls to bUnit v2 Render<T>().
tests/IgniteUI.Blazor.Tests/ToggleButtonTests.cs Updates component rendering calls to bUnit v2 Render<T>().
tests/IgniteUI.Blazor.Tests/TooltipTests.cs Updates component rendering calls to bUnit v2 Render<T>().
tests/IgniteUI.Blazor.Tests/TreeTests.cs Updates rendering calls and hosted contract setup to the new context-thunk host model.
skills/igniteui-blazor-lite-testing/SKILL.md Updates docs to reflect BunitContext naming in the test base class description.
Directory.Packages.props Bumps bunit package version to 2.8.6.

@damyanpetev
damyanpetev enabled auto-merge (squash) July 29, 2026 07:39
@damyanpetev
damyanpetev merged commit 7ace89b into master Jul 29, 2026
7 checks passed
@damyanpetev
damyanpetev deleted the dpetev/bunit-update branch July 29, 2026 08:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file 🧪 ci: tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants