Skip to content

Commit 683d8dd

Browse files
committed
add --base-dir flag to flow test for custom search directory
1 parent 0c3ff61 commit 683d8dd

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

internal/test/test.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ type flagsTests struct {
7777
Random bool `default:"false" flag:"random" info:"Use the random flag to execute test cases randomly"`
7878
Seed int64 `default:"0" flag:"seed" info:"Use the seed flag to manipulate random execution of test cases"`
7979
Name string `default:"" flag:"name" info:"Use the name flag to run only tests that match the given name"`
80+
BaseDir string `default:"" flag:"base-dir" info:"Directory to search for test files (defaults to current directory)"`
8081

8182
// Fork mode flags
8283
Fork string // Use definition in init()
@@ -130,8 +131,12 @@ func run(
130131

131132
var filenames []string
132133
if len(args) == 0 {
134+
baseDir := "."
135+
if testFlags.BaseDir != "" {
136+
baseDir = testFlags.BaseDir
137+
}
133138
var err error
134-
filenames, err = findAllTestFiles(".")
139+
filenames, err = findAllTestFiles(baseDir)
135140
if err != nil {
136141
return nil, fmt.Errorf("error loading script files: %w", err)
137142
}

0 commit comments

Comments
 (0)