diff options
Diffstat (limited to 'hugolib/js_test.go')
-rw-r--r-- | hugolib/js_test.go | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/hugolib/js_test.go b/hugolib/js_test.go index fbbd335b3..8d8e015a6 100644 --- a/hugolib/js_test.go +++ b/hugolib/js_test.go @@ -16,11 +16,12 @@ package hugolib import ( "fmt" "os" - "os/exec" "path/filepath" "runtime" "testing" + "github.com/gohugoio/hugo/common/hexec" + "github.com/gohugoio/hugo/htesting" "github.com/spf13/viper" @@ -125,7 +126,9 @@ TS: {{ template "print" $ts }} b.WithSourceFile("assets/js/included.js", includedJS) - out, err := exec.Command("npm", "install").CombinedOutput() + cmd, err := hexec.SafeCommand("npm", "install") + b.Assert(err, qt.IsNil) + out, err := cmd.CombinedOutput() b.Assert(err, qt.IsNil, qt.Commentf(string(out))) b.Build(BuildCfg{}) @@ -193,7 +196,8 @@ require github.com/gohugoio/hugoTestProjectJSModImports v0.5.0 // indirect }`) b.Assert(os.Chdir(workDir), qt.IsNil) - _, err = exec.Command("npm", "install").CombinedOutput() + cmd, _ := hexec.SafeCommand("npm", "install") + _, err = cmd.CombinedOutput() b.Assert(err, qt.IsNil) b.Build(BuildCfg{}) |