Skip to content

Commit

Permalink
Move wg.Add into test runner in case tests are skipped from -failfast
Browse files Browse the repository at this point in the history
  • Loading branch information
benvernier-sc committed Aug 1, 2023
1 parent ab22008 commit 69f2568
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions suite/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func Run(t *testing.T, suite TestingSuite) {
tests := []testing.InternalTest{}
methodFinder := reflect.TypeOf(suite)
suiteName := methodFinder.Elem().Name()
wg := &sync.WaitGroup{}
wg := new(sync.WaitGroup)

for i := 0; i < methodFinder.NumMethod(); i++ {
method := methodFinder.Method(i)
Expand All @@ -158,14 +158,14 @@ func Run(t *testing.T, suite TestingSuite) {
suiteSetupDone = true
}

wg.Add(1)

test := testing.InternalTest{
Name: method.Name,
F: func(t *testing.T) {
wg.Add(1)
defer wg.Done()

parentT := suite.T()
suite.SetT(t)
defer wg.Done()
defer recoverAndFailOnPanic(t)
defer func() {
r := recover()
Expand Down

0 comments on commit 69f2568

Please sign in to comment.