diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2020-10-08 08:42:36 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2020-10-10 00:23:01 +1100 |
commit | c1a6229c2c374ee18f18691683aa803aab5a57ab (patch) | |
tree | b917824e9cc3e0095c360f2e080ef49d1d859cf6 | |
parent | 4c9ec88be57ed75c198d19020374bae0365b6e00 (diff) |
install lazygit at beginning of test suite
-rw-r--r-- | pkg/gui/gui_test.go | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/pkg/gui/gui_test.go b/pkg/gui/gui_test.go index 0698afc5f..f632f971a 100644 --- a/pkg/gui/gui_test.go +++ b/pkg/gui/gui_test.go @@ -156,10 +156,21 @@ func getTestSpeeds(testStartSpeed int, updateSnapshots bool) []int { return speeds } +func tempLazygitPath() string { + return filepath.Join("/tmp", "lazygit", "test_lazygit") +} + func Test(t *testing.T) { rootDir := getRootDirectory() + err := os.Chdir(rootDir) + assert.NoError(t, err) + 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) record := os.Getenv("RECORD_EVENTS") != "" @@ -277,7 +288,6 @@ func runLazygit(t *testing.T, testPath string, rootDir string, record bool, spee osCommand := oscommands.NewDummyOSCommand() 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") 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) 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.Env = append(cmd.Env, fmt.Sprintf("REPLAY_SPEED=%d", speed)) |