Skip to content

Commit

Permalink
bug: more reliably find out if running in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
josemarluedke committed Nov 14, 2024
1 parent 0d97b3f commit a82027f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,12 @@ func unmarshalConfig(config interface{}) error {

func isTesting() bool {
for _, arg := range os.Args {
if strings.HasPrefix(arg, "-test.v=") {
if strings.Contains(arg, "-test") || strings.Contains(arg, ".test") {
return true
}
}
return false || os.Getenv("ENV") == "test"

return os.Getenv("ENV") == "test"
}

func getMetaConfig(config interface{}) *MetaConfig {
Expand Down

0 comments on commit a82027f

Please sign in to comment.