Skip to content

Detect and fail on require.* methods called from a wrong goroutine #1499

Description

@ash2k

As already documented (via #1392), require.* functions/methods are only safe to use from the main test/benchmark goroutine and are unsafe otherwise. Go stdlib may fix this one way or another (golang/go#15758) but even if/when this happens, testify doesn't call those methods unless there is an assertion failure. This means the bug in the test can live in users code for a very long time.

I think ideally testify would fail the test (or panic) if a function/method from the require family is used incorrectly regardless of whether there is a failure in the test itself or not.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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