Skip to content

Commit

Permalink
fix: actually set parallel to true by default (#33)
Browse files Browse the repository at this point in the history
Resolves #32
  • Loading branch information
dgunay authored Aug 23, 2024
1 parent 8921eae commit ae1ad2e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
4 changes: 3 additions & 1 deletion examples/api/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ type suite struct {

func TestApi(t *testing.T) {
scope := &suite{TestingT: t, resp: httptest.NewRecorder()}
run := gocuke.NewRunner(t, scope)
run := gocuke.
NewRunner(t, scope).
NonParallel()
run.Before(func() {
scope.resp = httptest.NewRecorder()
})
Expand Down
11 changes: 7 additions & 4 deletions hooks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ func TestHooks(t *testing.T) {
NewRunner(t, &hooksSuite{}).
Path("features/hooks.feature").
Tags("@long").
NonParallel().
Run()
assert.Assert(t, longRun)
assert.Assert(t, !shortRun)
Expand All @@ -25,6 +26,7 @@ func TestHooks(t *testing.T) {
NewRunner(t, &hooksSuite{}).
Path("features/hooks.feature").
ShortTags("not @long").
NonParallel().
Run()

assert.Assert(t, longRun)
Expand All @@ -33,12 +35,13 @@ func TestHooks(t *testing.T) {
if open != 0 {
t.Fatalf("expected 0 open resources, got: %d", open)
}

}

var longRun = false
var shortRun = false
var open int64 = 0
var (
longRun = false
shortRun = false
open int64 = 0
)

type hooksSuite struct {
TestingT
Expand Down
2 changes: 1 addition & 1 deletion runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func NewRunner(t *testing.T, suiteType interface{}) *Runner {
r := &Runner{
topLevelT: t,
incr: &messages.Incrementing{},
parallel: false,
parallel: true,
haveSuggestion: map[string]bool{},
supportedSpecialArgs: map[reflect.Type]specialArgGetter{
// TestingT
Expand Down
6 changes: 5 additions & 1 deletion simple_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ func (s *simpleSuite) IHaveLeft(a int64) {

// test if a struct that doesn't use a pointer and a global var
func TestSimpleNonPointer(t *testing.T) {
gocuke.NewRunner(t, simpleSuiteNP{}).Path("examples/simple/simple.feature").Run()
gocuke.
NewRunner(t, simpleSuiteNP{}).
Path("examples/simple/simple.feature").
NonParallel().
Run()
}

var globalCukes int64
Expand Down

0 comments on commit ae1ad2e

Please sign in to comment.