Skip to content

How to deal with functions that expect a testing.TB when using assert.EventuallyWithT #1862

@chancez

Description

@chancez

I have a bunch of custom assert functions that currently take either *testing.T or testing.TB, and I recently realized I cannot use any of them with assert.EventuallyWithT which we started using more heavily in our e2e tests, because the assert.CollectT is a concrete type that does not implement testing.TB. Obviously for the things we use that currently take a *testing.T we could update to a testing.TB but that doesn't fix the issue since CollectT doesn't implement testing.TB.

I'm wondering what kind of options we have to solve this. My current idea is maybe to just copying the current implementation of both assert.CollectT and assert.EventuallyWithT and adapt the CollectT implementation to implement testing.TB, but the interface is pretty large and I can see it might not play well with the requirements for a CollectT, so it doesn't seem trivial to do that.

I'm open to ideas, and of course I'd prefer if testify could fix this issue, but from my scanning of the GH issues around the assert.TestingT interface, the tHelper() interface and assert.CollectT types, it seems like fixing this directly isn't feasible without a huge rearchitecture of testify itself, so I'm open to writing my own functions to make this work.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions