diff --git a/fs_test.go b/fs_test.go index d811f45..73abd43 100644 --- a/fs_test.go +++ b/fs_test.go @@ -13,6 +13,8 @@ import ( ) func TestFinder(t *testing.T) { + skipWindows(t) + t.Parallel() fsys := fstest.MapFS{ diff --git a/util_test.go b/util_test.go index 941d8a2..b294b49 100644 --- a/util_test.go +++ b/util_test.go @@ -58,6 +58,8 @@ func TestCopyAndInsensitiviseMap(t *testing.T) { } func TestAbsPathify(t *testing.T) { + skipWindows(t) + home := userHomeDir() homer := filepath.Join(home, "homer") wd, _ := os.Getwd() diff --git a/viper_test.go b/viper_test.go index 349d09e..abe41fe 100644 --- a/viper_test.go +++ b/viper_test.go @@ -302,6 +302,8 @@ func (s *stringValue) String() string { } func TestGetConfigFile(t *testing.T) { + skipWindows(t) + t.Run("config file set", func(t *testing.T) { fs := afero.NewMemMapFs() @@ -438,6 +440,8 @@ func TestGetConfigFile(t *testing.T) { } func TestReadInConfig(t *testing.T) { + skipWindows(t) + t.Run("config file set", func(t *testing.T) { fs := afero.NewMemMapFs() @@ -1808,6 +1812,8 @@ func TestWriteConfigDotEnv(t *testing.T) { } func TestSafeWriteConfig(t *testing.T) { + skipWindows(t) + v := New() fs := afero.NewMemMapFs() v.SetFs(fs) @@ -1831,6 +1837,8 @@ func TestSafeWriteConfigWithMissingConfigPath(t *testing.T) { } func TestSafeWriteConfigWithExistingFile(t *testing.T) { + skipWindows(t) + v := New() fs := afero.NewMemMapFs() fs.Create("/test/c.yaml") @@ -1870,6 +1878,8 @@ func TestSafeWriteConfigAsWithExistingFile(t *testing.T) { } func TestWriteHiddenFile(t *testing.T) { + skipWindows(t) + v := New() fs := afero.NewMemMapFs() fs.Create("/test/.config") @@ -2556,3 +2566,10 @@ func BenchmarkGetBoolFromMap(b *testing.B) { } } } + +// Skip some tests on Windows that kept failing when Windows was added to the CI as a target. +func skipWindows(t *testing.T) { + if runtime.GOOS == "windows" { + t.Skip("Skip test on Windows") + } +}