From 4205912ff6faeeef9494b3c1a84c8c98c20c1d6e Mon Sep 17 00:00:00 2001 From: Steven Giesel Date: Sun, 13 Aug 2023 12:20:20 +0200 Subject: [PATCH] feat: Increase timeout to 5 minutes if a debugger is attached --- CHANGELOG.md | 2 +- src/bunit.core/Extensions/WaitForHelpers/WaitForHelper.cs | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c6aa6834..e02c9e029 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 5 minutes when a debugger is attached. By [@linkdotnet](https://github.com/linkdotnet). ## [1.22.19] - 2023-07-28 diff --git a/src/bunit.core/Extensions/WaitForHelpers/WaitForHelper.cs b/src/bunit.core/Extensions/WaitForHelpers/WaitForHelper.cs index f237f419b..dda573313 100644 --- a/src/bunit.core/Extensions/WaitForHelpers/WaitForHelper.cs +++ b/src/bunit.core/Extensions/WaitForHelpers/WaitForHelper.cs @@ -1,3 +1,4 @@ +using System.Diagnostics; using Bunit.Rendering; using Microsoft.Extensions.Logging; @@ -194,6 +195,9 @@ private void SubscribeToOnAfterRender() private static TimeSpan GetRuntimeTimeout(TimeSpan? timeout) { - return timeout ?? TestContextBase.DefaultWaitTimeout; + var defaultWaitTimeout = Debugger.IsAttached + ? TimeSpan.FromMinutes(5) + : TestContextBase.DefaultWaitTimeout; + return timeout ?? defaultWaitTimeout; } }