Open
Description
Without the os.Exit(m.Run()) line in the TestMain
function, control is never passed to the tests and TestMain is the only thing that runs. It can lead to tests appearing to pass when they never actually ran. The TestSanity
test "passes" below:
package main_test
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestMain(m *testing.M) {
}
func TestSanity(t *testing.T) {
assert.Equal(t, 1, 0)
}
It would be nice if there was a linting warning letting the developer know that not having this line could cause unexpected behavior.