1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-08 03:31:59 +02:00
goreleaser/internal/testlib/path.go
Carlos Alexandro Becker be6199f081
test: allow to locally skip some tests on missing tools (#2594)
* test: allow to locally skip some tests on missing tools

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>

* fix: ci tests

* fix: helper
2021-10-20 21:56:27 -03:00

20 lines
328 B
Go

package testlib
import (
"os"
"os/exec"
"testing"
)
// CheckPath skips the test if the binary is not in the PATH.
func CheckPath(tb testing.TB, cmd string) {
tb.Helper()
if os.Getenv("CI") == "true" {
// never skip on CI
return
}
if _, err := exec.LookPath(cmd); err != nil {
tb.Skipf("%s not in PATH", cmd)
}
}