Repository: go-bdd/gobdd
Pull request #156 (2025-04-17 12:02:54)

feat: allow multiple pattern in WithFeaturesFS
With a file system defined as 
```go
//go:embed *.feature */*.feature
var features embed.FS
```
it is not currently possible to select feature from both the root directory and a sub directory. 
After the change, it can be accomplished with `gobdd.WithFeaturesFS(features.Features.FS, "*.feature, "*/*.feature")`


Patch:
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index e7b197f..b390346 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -26,7 +26,7 @@ jobs:
     runs-on: ubuntu-latest
     strategy:
       matrix:
-        go: [ '1.17', '1.18', '1.19', '1.20', '1.21', '1.22', '1.23' ]
+        go: [ '1.17', '1.18', '1.19', '1.20', '1.21', '1.22', '1.23', '1.24' ]
     env:
       GOFLAGS: -mod=readonly
       GOPROXY: https://proxy.golang.org
diff --git a/docs/suite-options.md b/docs/suite-options.md
index fd8975b..cc74e9d 100644
--- a/docs/suite-options.md
+++ b/docs/suite-options.md
@@ -9,7 +9,7 @@ The suite can be confiugred using one of these functions:
 
 * `RunInParallel()` - enables running steps in parallel. It uses the stanard `T.Parallel` function.
 * `WithFeaturesPath(path string)` - configures the path where GoBDD should look for features. The default value is `features/*.feature`.
-* `WithFeaturesFS(fs fs.FS, path string)` - configures the filesystem and a path (glob pattern) where GoBDD should look for features.
+* `WithFeaturesFS(fs fs.FS, patterns ...string)` - configures the filesystem and glob patterns where GoBDD should look for features.
 * `WithTags(tags ...string)` - configures which tags should be run. Every tag has to start with `@`.
 * `WithBeforeScenario(f func())` - this function `f` will be called before every scenario.
 * `WithAfterScenario(f func())` - this funcion `f` will be called after every scenario.
diff --git a/go.mod b/go.mod
index 196bc52..a58d21a 100644
--- a/go.mod
+++ b/go.mod
@@ -3,15 +3,15 @@ module github.com/go-bdd/gobdd
 go 1.17
 
 require (
-	github.com/cucumber/gherkin/go/v28 v28.0.0
-	github.com/cucumber/messages/go/v24 v24.1.0
+	github.com/cucumber/gherkin/go/v33 v33.0.0
+	github.com/cucumber/messages/go/v28 v28.0.0
 	github.com/go-bdd/assert v0.0.0-20200713105154-236f01430281
-	github.com/stretchr/testify v1.9.0
+	github.com/stretchr/testify v1.10.0
 )
 
 require (
 	github.com/davecgh/go-spew v1.1.1 // indirect
-	github.com/gofrs/uuid v4.4.0+incompatible // indirect
+	github.com/google/uuid v1.6.0 // indirect
 	github.com/kr/text v0.2.0 // indirect
 	github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
 	github.com/pmezard/go-difflib v1.0.0 // indirect
diff --git a/go.sum b/go.sum
index 71af307..7a2afaa 100644
--- a/go.sum
+++ b/go.sum
@@ -1,16 +1,15 @@
 github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
-github.com/cucumber/gherkin/go/v28 v28.0.0 h1:SBqwscPOhe83JF0ukpEj+4QZ2ScOpPQByC0gD3cXBkg=
-github.com/cucumber/gherkin/go/v28 v28.0.0/go.mod h1:HVwDrzWvtsVbkxHw6KVZFA79x5uSLb+ajzS0BXuHiE8=
-github.com/cucumber/messages/go/v24 v24.0.1/go.mod h1:ns4Befq4c4n9/B5APpTlBu5kXL1DVE4+5bbe0vSV4fc=
-github.com/cucumber/messages/go/v24 v24.1.0 h1:JMpspvV3IoGwcbEUbsKuxr0tRkFP7aqcQ5SvoanS/DA=
-github.com/cucumber/messages/go/v24 v24.1.0/go.mod h1:PR0+ygYqqyT1/C4EmioDdvgR8YG9+SZEkxEKw2jfd8g=
+github.com/cucumber/gherkin/go/v33 v33.0.0 h1:PqQ81cHjD732/GZ7c/6k/sjlYG4LzLp51nggL6172Sg=
+github.com/cucumber/gherkin/go/v33 v33.0.0/go.mod h1:mnP4fdkoc+LmjSLi9Kq3M5D84GphRWLdgeKAlvUYp2c=
+github.com/cucumber/messages/go/v28 v28.0.0 h1:BOJmy8LKSbdKxM6Ba1v9ZmpZk7j5cyH+LTAaGxMeflc=
+github.com/cucumber/messages/go/v28 v28.0.0/go.mod h1:2njGQBk+mu0aqzQgN8xcXvnrfWNcP7UjEyi1YauQ5Lc=
 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
 github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
 github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
 github.com/go-bdd/assert v0.0.0-20200713105154-236f01430281 h1:jfonqldVSNVekjmLvHqelFzBba7SwylNIZ3fbM/lKVs=
 github.com/go-bdd/assert v0.0.0-20200713105154-236f01430281/go.mod h1:dOoqt7g2I/fpR7/Pyz0P19J3xjDj5lsHn3v9EaFLRjM=
-github.com/gofrs/uuid v4.4.0+incompatible h1:3qXRTX8/NbyulANqlc0lchS1gqAVxRgsuW1YrTJupqA=
-github.com/gofrs/uuid v4.4.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
+github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
+github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
 github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
 github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
 github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
@@ -26,8 +25,8 @@ github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/
 github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
 github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
 github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
-github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
-github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
+github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
+github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
 gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
 gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
 gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
diff --git a/gobdd.go b/gobdd.go
index 16359e0..702c2ef 100644
--- a/gobdd.go
+++ b/gobdd.go
@@ -13,8 +13,8 @@ import (
 	"strings"
 	"testing"
 
-	gherkin "github.com/cucumber/gherkin/go/v28"
-	msgs "github.com/cucumber/messages/go/v24"
+	gherkin "github.com/cucumber/gherkin/go/v33"
+	msgs "github.com/cucumber/messages/go/v28"
 )
 
 const contextArgumentsNumber = 2
diff --git a/gobdd_go1_16.go b/gobdd_go1_16.go
index 2e4d4f4..5ce2970 100644
--- a/gobdd_go1_16.go
+++ b/gobdd_go1_16.go
@@ -10,29 +10,33 @@ import (
 )
 
 // WithFeaturesFS configures a filesystem and a path (glob pattern) where features can be found.
-func WithFeaturesFS(fs fs.FS, path string) func(*SuiteOptions) {
+func WithFeaturesFS(fs fs.FS, patterns ...string) func(*SuiteOptions) {
 	return func(options *SuiteOptions) {
 		options.featureSource = fsFeatureSource{
-			fs:   fs,
-			path: path,
+			fs:       fs,
+			patterns: patterns,
 		}
 	}
 }
 
 type fsFeatureSource struct {
-	fs   fs.FS
-	path string
+	fs       fs.FS
+	patterns []string
 }
 
 func (s fsFeatureSource) loadFeatures() ([]feature, error) {
-	files, err := fs.Glob(s.fs, s.path)
-	if err != nil {
-		return nil, fmt.Errorf("loading features: %w", err)
+	var allFiles []string
+	for _, pattern := range s.patterns {
+		files, err := fs.Glob(s.fs, pattern)
+		if err != nil {
+			return nil, fmt.Errorf("loading features: %w", err)
+		}
+		allFiles = append(allFiles, files...)
 	}
 
-	features := make([]feature, 0, len(files))
+	features := make([]feature, 0, len(allFiles))
 
-	for _, f := range files {
+	for _, f := range allFiles {
 		features = append(features, fsFeature{
 			fs:   s.fs,
 			file: f,


Test patch:
diff --git a/gobdd_go1_16_test.go b/gobdd_go1_16_test.go
index 3083599..5f21edd 100644
--- a/gobdd_go1_16_test.go
+++ b/gobdd_go1_16_test.go
@@ -9,7 +9,7 @@ import (
 )
 
 func TestWithFeaturesFS(t *testing.T) {
-	suite := NewSuite(t, WithFeaturesFS(featuresFS, "example.feature"))
+	suite := NewSuite(t, WithFeaturesFS(featuresFS, "example.feature", "example_rule.feature"))
 	compiled := regexp.MustCompile(`I add (\d+) and (\d+)`)
 	suite.AddRegexStep(compiled, add)
 	compiled = regexp.MustCompile(`the result should equal (\d+)`)
diff --git a/gobdd_test.go b/gobdd_test.go
index 90b93cb..239533f 100644
--- a/gobdd_test.go
+++ b/gobdd_test.go
@@ -7,7 +7,7 @@ import (
 	"strings"
 	"testing"
 
-	msgs "github.com/cucumber/messages/go/v24"
+	msgs "github.com/cucumber/messages/go/v28"
 	"github.com/go-bdd/assert"
 	"github.com/stretchr/testify/require"
 )