Skip to content

Commit

Permalink
mage: read env variable to pass arguments to test
Browse files Browse the repository at this point in the history
  • Loading branch information
gbrlsnchs committed Sep 14, 2019
1 parent 821eee0 commit 6146ca5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"os"
"path/filepath"
"runtime"
"strings"

"github.com/magefile/mage/sh"
)
Expand Down Expand Up @@ -91,7 +92,9 @@ func Test() error {
if err != nil {
return err
}
return sh.Run(goCmd, "test", filepath.Join(root, "..."))
flags := strings.Split(os.Getenv("TEST_FLAGS"), " ")
args := append([]string{"test"}, flags...)
return sh.Run(goCmd, append(args, filepath.Join(root, "..."))...)
}

func findRoot(dir string) (string, error) {
Expand Down

0 comments on commit 6146ca5

Please sign in to comment.