mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-02-01 13:17:53 +02:00
install lazygit at beginning of test suite
This commit is contained in:
parent
4c9ec88be5
commit
c1a6229c2c
@ -156,10 +156,21 @@ func getTestSpeeds(testStartSpeed int, updateSnapshots bool) []int {
|
|||||||
return speeds
|
return speeds
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func tempLazygitPath() string {
|
||||||
|
return filepath.Join("/tmp", "lazygit", "test_lazygit")
|
||||||
|
}
|
||||||
|
|
||||||
func Test(t *testing.T) {
|
func Test(t *testing.T) {
|
||||||
rootDir := getRootDirectory()
|
rootDir := getRootDirectory()
|
||||||
|
err := os.Chdir(rootDir)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
|
||||||
testDir := filepath.Join(rootDir, "test", "integration")
|
testDir := filepath.Join(rootDir, "test", "integration")
|
||||||
|
|
||||||
|
osCommand := oscommands.NewDummyOSCommand()
|
||||||
|
err = osCommand.RunCommand("go build -o %s", tempLazygitPath())
|
||||||
|
assert.NoError(t, err)
|
||||||
|
|
||||||
tests := loadTests(t, testDir)
|
tests := loadTests(t, testDir)
|
||||||
|
|
||||||
record := os.Getenv("RECORD_EVENTS") != ""
|
record := os.Getenv("RECORD_EVENTS") != ""
|
||||||
@ -277,7 +288,6 @@ func runLazygit(t *testing.T, testPath string, rootDir string, record bool, spee
|
|||||||
osCommand := oscommands.NewDummyOSCommand()
|
osCommand := oscommands.NewDummyOSCommand()
|
||||||
|
|
||||||
replayPath := filepath.Join(testPath, "recording.json")
|
replayPath := filepath.Join(testPath, "recording.json")
|
||||||
cmdStr := fmt.Sprintf("go run %s", filepath.Join(rootDir, "main.go"))
|
|
||||||
templateConfigDir := filepath.Join(rootDir, "test", "default_test_config")
|
templateConfigDir := filepath.Join(rootDir, "test", "default_test_config")
|
||||||
actualDir := filepath.Join(testPath, "actual")
|
actualDir := filepath.Join(testPath, "actual")
|
||||||
|
|
||||||
@ -295,7 +305,7 @@ func runLazygit(t *testing.T, testPath string, rootDir string, record bool, spee
|
|||||||
err = oscommands.CopyDir(templateConfigDir, configDir)
|
err = oscommands.CopyDir(templateConfigDir, configDir)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
cmdStr = fmt.Sprintf("%s --use-config-dir=%s --path=%s", cmdStr, configDir, actualDir)
|
cmdStr := fmt.Sprintf("%s --use-config-dir=%s --path=%s", tempLazygitPath(), configDir, actualDir)
|
||||||
|
|
||||||
cmd := osCommand.ExecutableFromString(cmdStr)
|
cmd := osCommand.ExecutableFromString(cmdStr)
|
||||||
cmd.Env = append(cmd.Env, fmt.Sprintf("REPLAY_SPEED=%d", speed))
|
cmd.Env = append(cmd.Env, fmt.Sprintf("REPLAY_SPEED=%d", speed))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user