Skip to content

fix(assert): fail Never when condition does not return before timeout#1901

Open
leno23 wants to merge 1 commit into
stretchr:masterfrom
leno23:fix/never-timeout-before-condition-returns-1654
Open

fix(assert): fail Never when condition does not return before timeout#1901
leno23 wants to merge 1 commit into
stretchr:masterfrom
leno23:fix/never-timeout-before-condition-returns-1654

Conversation

@leno23
Copy link
Copy Markdown

@leno23 leno23 commented May 25, 2026

Summary

  • Track whether Never's condition completed at least once before waitFor elapses
  • Fail with "Condition never completed before timeout" when the timeout fires without any evaluation result

Fixes #1654

Problem

If the condition blocks longer than waitFor, Never could return success without ever observing the condition result.

Test plan

  • go test ./assert -run TestNever
  • Added TestNeverTimeoutBeforeConditionReturns matching the issue reproducer

Track whether the condition completed at least once. If waitFor
elapses before the first evaluation returns, report a failure instead
of passing without checking.

Fixes stretchr#1654
@leno23 leno23 force-pushed the fix/never-timeout-before-condition-returns-1654 branch from 3bdb1c4 to 2f881ed Compare May 26, 2026 05:03
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.

Never: unexpectedly succeeds if timeout reached before condition returns

1 participant