Skip to content

Commit

Permalink
Merge pull request #1202 from bUnit-dev/release/v1.23
Browse files Browse the repository at this point in the history
Release of new minor version v1.23
  • Loading branch information
egil authored Sep 6, 2023
2 parents a36530e + ce07a60 commit 1bd08f5
Show file tree
Hide file tree
Showing 59 changed files with 464 additions and 347 deletions.
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
]
},
"docfx": {
"version": "2.67.0",
"version": "2.70.0",
"commands": [
"docfx"
]
Expand Down
10 changes: 0 additions & 10 deletions .github/nightly-failed.md

This file was deleted.

3 changes: 2 additions & 1 deletion .github/workflows/docs-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
steps:

- name: 🛒 Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.BUNIT_BOT_TOKEN }}
Expand Down Expand Up @@ -68,6 +68,7 @@ jobs:
5.0.x
6.0.x
7.0.x
8.0.x
- name: 🎨 Setup color
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
if: github.ref == 'refs/heads/main' && contains(fromJson('["major","minor"]'), github.event.inputs.versionIncrement)
steps:
- name: 🛒 Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.BUNIT_BOT_TOKEN }}
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/release-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
nugetRelease:
description: 'Release to NuGet? Set to "true" to release to NuGet.org as well as GPR.'
required: true
default: 'false'
default: 'true'

jobs:
release-preview:
Expand All @@ -21,7 +21,7 @@ jobs:
steps:

- name: 🛒 Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand All @@ -36,6 +36,7 @@ jobs:
5.0.x
6.0.x
7.0.x
8.0.x
- name: 🎨 Setup color
run: |
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
steps:

- name: 🛒 Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.BUNIT_BOT_TOKEN }}
Expand Down Expand Up @@ -67,6 +67,7 @@ jobs:
5.0.x
6.0.x
7.0.x
8.0.x
- name: 🛠️ Update changelog
uses: thomaseizinger/[email protected]
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/verification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:

steps:
- name: 🛒 Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand All @@ -48,6 +48,7 @@ jobs:
5.0.x
6.0.x
7.0.x
8.0.x
- name: 🎨 Setup color
if: matrix.os != 'windows-latest'
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@ All notable changes to **bUnit** will be documented in this file. The project ad

## [Unreleased]

### Fixed

- If the renderer was not idle when calling `SetParametersAndRender`, the method could return before the parameters were set and the component under test had finished rendering. This was a regression that happened in v1.21.9. Reported by [@Skintkingle](https://github.com/Skintkingle]) in <https://github.com/bUnit-dev/bUnit/issues/1188>. Fixed by [@egil](https://github.com/egil).

### Added

- `net8.0` support
- Increased timeout of `WaitForAssertion` to infinite when a debugger is attached. By [@linkdotnet](https://github.com/linkdotnet).

### Fixed

- AngleSharp IElement extension methods do not work with `IRenderedFragment.Find`. Reported by [a2er](https://github.com/a2er). Fixed by [@linkdotnet](https://github.com/linkdotnet).

## [1.22.19] - 2023-07-28

### Added
Expand Down
7 changes: 4 additions & 3 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<DotNet5Version>5.0.0</DotNet5Version>
<DotNet6Version>6.0.0</DotNet6Version>
<DotNet7Version>7.0.0</DotNet7Version>
<DotNet8Version>8.0.0-*</DotNet8Version>
</PropertyGroup>

<!-- Solution wide properties -->
Expand All @@ -21,7 +22,7 @@
<LangVersion>11.0</LangVersion>
<AccelerateBuildsInVisualStudio>false</AccelerateBuildsInVisualStudio>
<ImplicitUsings>enable</ImplicitUsings>
<NoWarn>CA1014,NU5104,NETSDK1138</NoWarn>
<NoWarn>CA1014,NU5104,NETSDK1138,SYSLIB0051</NoWarn>
<CheckEolTargetFramework>false</CheckEolTargetFramework>

<!-- Used by code coverage -->
Expand All @@ -38,7 +39,7 @@
<PropertyGroup Label="Analyzer settings">
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<AnalysisLevel>latest</AnalysisLevel>
<AnalysisLevel>7</AnalysisLevel>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
</PropertyGroup>

Expand All @@ -50,7 +51,7 @@
<!-- Shared code analyzers used for all projects in the solution -->
<ItemGroup Label="Code Analyzers">
<PackageReference Include="AsyncFixer" Version="1.6.0" PrivateAssets="All" />
<PackageReference Include="SonarAnalyzer.CSharp" Version="9.6.0.74858" PrivateAssets="All" />
<PackageReference Include="SonarAnalyzer.CSharp" Version="9.9.0.77355" PrivateAssets="All" />
</ItemGroup>

<ItemGroup Label="Implicit usings"
Expand Down
2 changes: 1 addition & 1 deletion benchmark/bunit.benchmarks/bunit.benchmarks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.13.5" />
<PackageReference Include="BenchmarkDotNet" Version="0.13.7" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 4 additions & 0 deletions docs/site/docs/interaction/awaiting-async-state.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,7 @@ The timeout, which defaults to one second, can be controlled by passing a `TimeS
If the timeout is reached, a <xref:Bunit.Extensions.WaitForHelpers.WaitForFailedException> exception is thrown with the following error message:

> The state predicate did not pass before the timeout period passed.
## Debugging code that uses `WaitForState`, `WaitForAssertion`, or `WaitForElement`

When `bUnit` detects that a debugger is attached (`Debugger.IsAttached`), it will automatically disable the timeout functionality of the "wait for" methods.
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"rollForward": "latestMajor",
"allowPrerelease": false
"allowPrerelease": true
}
}
107 changes: 0 additions & 107 deletions src/AngleSharpWrappers/Generated/WrapperFactory.g.cs

This file was deleted.

10 changes: 9 additions & 1 deletion src/bunit.core/Extensions/RenderedComponentRenderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,15 @@ public static void SetParametersAndRender<TComponent>(this IRenderedComponentBas
throw new ArgumentNullException(nameof(renderedComponent));

var renderer = renderedComponent.Services.GetRequiredService<TestRenderer>();
renderer.SetDirectParameters(renderedComponent, parameters);

try
{
renderer.SetDirectParametersAsync(renderedComponent, parameters).GetAwaiter().GetResult();
}
catch (AggregateException e) when (e.InnerExceptions.Count == 1)
{
ExceptionDispatchInfo.Capture(e.InnerExceptions[0]).Throw();
}
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ public static class RenderedFragmentWaitForHelperExtensions
/// <param name="statePredicate">The predicate to invoke after each render, which must returns <c>true</c> when the desired state has been reached.</param>
/// <param name="timeout">The maximum time to wait for the desired state.</param>
/// <exception cref="WaitForFailedException">Thrown if the <paramref name="statePredicate"/> throw an exception during invocation, or if the timeout has been reached. See the inner exception for details.</exception>
/// <remarks>
/// If a debugger is attached the timeout is set to <see cref="Timeout.InfiniteTimeSpan" />, giving the possibility to debug without the timeout triggering.
/// </remarks>
public static void WaitForState(this IRenderedFragmentBase renderedFragment, Func<bool> statePredicate, TimeSpan? timeout = null)
{
using var waiter = new WaitForStateHelper(renderedFragment, statePredicate, timeout);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ public class WaitForAssertionHelper : WaitForHelper<object?>
/// <param name="renderedFragment">The rendered fragment to wait for renders from and assert against.</param>
/// <param name="assertion">The verification or assertion to perform.</param>
/// <param name="timeout">The maximum time to attempt the verification.</param>
/// <remarks>
/// If a debugger is attached the timeout is set to <see cref="Timeout.InfiniteTimeSpan" />, giving the possibility to debug without the timeout triggering.
/// </remarks>
public WaitForAssertionHelper(IRenderedFragmentBase renderedFragment, Action assertion, TimeSpan? timeout = null)
: base(
renderedFragment,
Expand Down
5 changes: 4 additions & 1 deletion src/bunit.core/Extensions/WaitForHelpers/WaitForHelper.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Diagnostics;
using Bunit.Rendering;
using Microsoft.Extensions.Logging;

Expand Down Expand Up @@ -194,6 +195,8 @@ private void SubscribeToOnAfterRender()

private static TimeSpan GetRuntimeTimeout(TimeSpan? timeout)
{
return timeout ?? TestContextBase.DefaultWaitTimeout;
return Debugger.IsAttached
? Timeout.InfiniteTimeSpan
: timeout ?? TestContextBase.DefaultWaitTimeout;
}
}
Loading

0 comments on commit 1bd08f5

Please sign in to comment.