Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2021-06-16 19:58:40 +0300
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2021-06-16 19:58:40 +0300
commit31fb29fb3f306678f3697e05bbccefb2078d7f78 (patch)
tree716f2586c71abf1f49dc9e1fec450c4b7796ab6e /common
parentd392893cd73dc00c927f342778f6dca9628d328e (diff)
Do not read config from os.Environ when running tests
Fixes #8655
Diffstat (limited to 'common')
-rw-r--r--common/hugo/hugo.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/common/hugo/hugo.go b/common/hugo/hugo.go
index 13ed47736..bf3dee26e 100644
--- a/common/hugo/hugo.go
+++ b/common/hugo/hugo.go
@@ -141,3 +141,13 @@ func GetDependencyList() []string {
return deps
}
+
+// IsRunningAsTest reports whether we are running as a test.
+func IsRunningAsTest() bool {
+ for _, arg := range os.Args {
+ if strings.HasPrefix(arg, "-test") {
+ return true
+ }
+ }
+ return false
+}