Skip to content

If condition passed to Never does not return before waitFor, then the Never assertion passes. #1654

@brackendawson

Description

@brackendawson

Description

If a condition function is passed to Never which does not return once before waitFor elapses, then the assertion passes having never completed a single check.

Never asserts that the given condition doesn't satisfy in waitFor time...

Technically this is correct, but I think our implementation of it is surprising.

Step To Reproduce

func TestIfy(t *testing.T) {
	assert.Never(t, func() bool {
		time.Sleep(2 * time.Second)
		return true // this should fail
	}, time.Millisecond, time.Second)
}

Expected behavior

The test fails because the condition is statically true

Actual behavior

Test passes

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions