mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-05 00:59:19 +02:00
Fix running 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.
This commit is contained in:
@ -5,6 +5,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"runtime"
|
||||||
|
|
||||||
lazycoreUtils "github.com/jesseduffield/lazycore/pkg/utils"
|
lazycoreUtils "github.com/jesseduffield/lazycore/pkg/utils"
|
||||||
"github.com/jesseduffield/lazygit/pkg/commands/git_commands"
|
"github.com/jesseduffield/lazygit/pkg/commands/git_commands"
|
||||||
@ -254,11 +255,16 @@ func getLazygitCommand(
|
|||||||
}
|
}
|
||||||
|
|
||||||
func tempLazygitPath() string {
|
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 {
|
func raceDetectorLogsPath() string {
|
||||||
return filepath.Join("/tmp", "lazygit", "race_log")
|
return filepath.Join(os.TempDir(), "lazygit", "race_log")
|
||||||
}
|
}
|
||||||
|
|
||||||
func findOrCreateDir(path string) {
|
func findOrCreateDir(path string) {
|
||||||
|
@ -2,6 +2,7 @@ package components
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@ -223,7 +224,7 @@ func testNameFromCurrentFilePath() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestNameFromFilePath(path string) 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")]
|
return name[:len(name)-len(".go")]
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user