diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2024-01-12 23:33:26 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-12 23:33:26 +1100 |
commit | e9962b98a761a054b9ba8c042904d8e5572e59be (patch) | |
tree | 7a4887ba52df45f711f531ea7844cf4ba34f5f58 /pkg/integration/clients/tui.go | |
parent | 5c888a0b474ed2fc45c7640b4e73e2bf272f2d3c (diff) | |
parent | a1ce6029c13ab69ae6e7d08a8f9593435abb5b92 (diff) |
Set working directory in lazygit test command (#3215)
We need to fetch our list of tests both outside of our test binary and
within. We need to get the list from within so that we can run the code
that drives the test and runs assertions. To get the list of tests we
need to know where the root of the lazygit repo is, given that the tests
live in files under that root.
So far, we've used this GetLazyRootDirectory() function for that, but it
assumes that we're not in a test directory (it just looks for the first
.git dir it can find). Because we didn't want to properly fix this
before, we've been setting the working directory of the test command to
the lazygit root, and using the --path CLI arg to override it when the
test itself ran. This was a terrible hack.
Now, we're passing the lazygit root directory as an env var to the
integration test, so that we can set the working directory to the actual
path of the test repo; removing the need to use the --path arg.
- **PR Description**
- **Please check if the PR fulfills these requirements**
* [x] Cheatsheets are up-to-date (run `go generate ./...`)
* [x] Code has been formatted (see
[here](https://github.com/jesseduffield/lazygit/blob/master/CONTRIBUTING.md#code-formatting))
* [x] Tests have been added/updated (see
[here](https://github.com/jesseduffield/lazygit/blob/master/pkg/integration/README.md)
for the integration test guide)
* [x] Text is internationalised (see
[here](https://github.com/jesseduffield/lazygit/blob/master/CONTRIBUTING.md#internationalisation))
* [x] Docs (specifically `docs/Config.md`) have been updated if
necessary
* [x] You've read through your own file changes for silly mistakes etc
<!--
Be sure to name your PR with an imperative e.g. 'Add worktrees view'
see https://github.com/jesseduffield/lazygit/releases/tag/v0.40.0 for
examples
-->
Diffstat (limited to 'pkg/integration/clients/tui.go')
-rw-r--r-- | pkg/integration/clients/tui.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/pkg/integration/clients/tui.go b/pkg/integration/clients/tui.go index 05db98991..ded94f74d 100644 --- a/pkg/integration/clients/tui.go +++ b/pkg/integration/clients/tui.go @@ -233,7 +233,7 @@ type app struct { } func newApp(testDir string) *app { - return &app{testDir: testDir, allTests: tests.GetTests()} + return &app{testDir: testDir, allTests: tests.GetTests(utils.GetLazyRootDirectory())} } func (self *app) getCurrentTest() *components.IntegrationTest { |