testify icon indicating copy to clipboard operation
testify copied to clipboard

EventuallyWithTf function help is incorrect, misleading callback signature

Open nomaed opened this issue 2 months ago • 0 comments

Documentation shows that the callback function format is func(c *assert.CollectT, "error message %s", "formatted") which is incorrect.

Formatting arguments are only valid for EventuallyWithTf itself, while the callback is just func(c *assert.CollectT).

The issue appears for:

  • assert.EventuallyWithTf(): https://github.com/stretchr/testify/blob/429ee0b8f4efde767b69e2b6421ec6dfbd75fd22/assert/assertion_format.go#L193
  • require.EventuallyWithTf(): https://github.com/stretchr/testify/blob/429ee0b8f4efde767b69e2b6421ec6dfbd75fd22/require/require.go#L460
  • As a method on*Assertion receiver in assert package: https://github.com/stretchr/testify/blob/429ee0b8f4efde767b69e2b6421ec6dfbd75fd22/assert/assertion_forward.go#L375
  • As a method on*Assertion receiver in require package: https://github.com/stretchr/testify/blob/429ee0b8f4efde767b69e2b6421ec6dfbd75fd22/require/require_forward.go#L376

nomaed avatar Nov 25 '25 10:11 nomaed