diff options
author | Stefan Haller <stefan@haller-berlin.de> | 2024-01-19 22:02:37 +0100 |
---|---|---|
committer | Stefan Haller <stefan@haller-berlin.de> | 2024-01-20 18:32:39 +0100 |
commit | 8311933de43b890868482686940b72506d45ff4f (patch) | |
tree | cea2ea288f5f29226cf8fe5a998c45477d39ef80 | |
parent | 0afcc3d34d73b41f57b46e01c04648821c4608a2 (diff) |
Fix running integration tests on Windowsrun-integration-tests-on-windows
At least they now work when using
go run cmd/integration_test/main.go cli
or
go run cmd/integration_test/main.go tui
I haven't been able to get them to run headless (i.e. using
"go test pkg/integration/clients/*.go"), which prevents us from running them on
CI.
-rw-r--r-- | pkg/integration/components/runner.go | 10 | ||||
-rw-r--r-- | pkg/integration/components/test.go | 3 |
2 files changed, 10 insertions, 3 deletions
diff --git a/pkg/integration/components/runner.go b/pkg/integration/components/runner.go index 064dd5c5b..e02984520 100644 --- a/pkg/integration/components/runner.go +++ b/pkg/integration/components/runner.go @@ -5,6 +5,7 @@ import ( "os" "os/exec" "path/filepath" + "runtime" lazycoreUtils "github.com/jesseduffield/lazycore/pkg/utils" "github.com/jesseduffield/lazygit/pkg/commands/git_commands" @@ -254,11 +255,16 @@ func getLazygitCommand( } func tempLazygitPath() string { - return filepath.Join("/tmp", "lazygit", "test_lazygit") + filename := "test_lazygit" + if runtime.GOOS == "windows" { + filename = "test_lazygit.exe" + } + + return filepath.Join(os.TempDir(), "lazygit", filename) } func raceDetectorLogsPath() string { - return filepath.Join("/tmp", "lazygit", "race_log") + return filepath.Join(os.TempDir(), "lazygit", "race_log") } func findOrCreateDir(path string) { diff --git a/pkg/integration/components/test.go b/pkg/integration/components/test.go index 203436ae7..12a89784a 100644 --- a/pkg/integration/components/test.go +++ b/pkg/integration/components/test.go @@ -2,6 +2,7 @@ package components import ( "os" + "path/filepath" "strconv" "strings" @@ -223,7 +224,7 @@ func testNameFromCurrentFilePath() string { } func TestNameFromFilePath(path string) string { - name := strings.Split(path, "integration/tests/")[1] + name := strings.Split(filepath.ToSlash(path), "integration/tests/")[1] return name[:len(name)-len(".go")] } |