Skip to content

Commit

Permalink
feat: Increase timeout to Infinite if a debugger is attached
Browse files Browse the repository at this point in the history
  • Loading branch information
linkdotnet committed Aug 13, 2023
1 parent d73f519 commit 869f5ac
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ All notable changes to **bUnit** will be documented in this file. The project ad

## [Unreleased]


### Added

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

## [1.22.19] - 2023-07-28

Expand Down
6 changes: 5 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,9 @@ private void SubscribeToOnAfterRender()

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

0 comments on commit 869f5ac

Please sign in to comment.