Skip to content

Commit f47488d

Browse files
committed
A bit nicer skip implementation
1 parent 41c7470 commit f47488d

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

internal/build/ci.go

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
//go:build ci
2+
3+
package build
4+
5+
// IsCI indicates that tests are running in CI.
6+
const IsCI = true

internal/build/notci.go

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
//go:build !ci
2+
3+
package build
4+
5+
// IsCI indicates that tests are not running in CI.
6+
const IsCI = false

internal/osext/osext_test.go

+8-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import (
1616
"path/filepath"
1717
"runtime"
1818
"testing"
19+
20+
"github.com/fynelabs/selfupdate/internal/build"
1921
)
2022

2123
const (
@@ -76,7 +78,9 @@ func TestExecutableMatch(t *testing.T) {
7678
t.Fatalf("Child returned %q, want an absolute path", out)
7779
}
7880

79-
t.Skip() // Executables to not match with coverage data embedded.
81+
if build.IsCI {
82+
return // Executables to not match with coverage data embedded.
83+
}
8084

8185
if !sameFile(outs, ep) {
8286
t.Fatalf("Child returned %q, not the same file as %q", out, ep)
@@ -136,7 +140,9 @@ func TestExecutableDelete(t *testing.T) {
136140
t.Fatalf("Child returned %q, want an absolute path", childPath)
137141
}
138142

139-
t.Skip() // Executables to not match with coverage data embedded.
143+
if build.IsCI {
144+
return // Executables to not match with coverage data embedded.
145+
}
140146

141147
if !sameFile(childPath, fpath) {
142148
t.Fatalf("Child returned %q, not the same file as %q", childPath, fpath)

0 commit comments

Comments
 (0)