diff --git a/AGENTS.md b/AGENTS.md index 2fb36392e..8a4f924e4 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -21,8 +21,9 @@ Windows box has only `just`). - `just format` — `gofumpt -l -w .`. Run before every commit. - `just build` — build the binary. - `just unit-test` — `go test ./... -short`. -- `just e2e-all` — run all integration tests headlessly (`just e2e ` runs a - single one with a visible UI). +- `just e2e` — run all integration tests headlessly; `just e2e ` runs a + single one headlessly too. `just e2e-cli ` runs one with a visible UI + (most useful with `--sandbox` or `--slow`). - `just lint` — run golangci-lint. ## When to commit diff --git a/justfile b/justfile index e7f9fcdc5..c6785b933 100644 --- a/justfile +++ b/justfile @@ -23,7 +23,7 @@ unit-test: # Run both unit tests and integration tests. [unix] -test: unit-test e2e-all +test: unit-test e2e # On Windows, integration tests are not supported right now [windows] @@ -39,18 +39,29 @@ format: lint: ./scripts/golangci-lint-shim.sh run -# Run integration tests with a visible UI. Most useful for running a single test; for running all tests, use `e2e-all` instead. +e2e-test-command := "go test pkg/integration/clients/*.go" + +# Run integration tests headlessly: no args runs all tests, a test name (or path) runs just that one. Use e2e-cli for a visible UI. e2e *args: + {{ if args == "" { e2e-test-command } else { \ + e2e-test-command + " -run 'TestIntegration/" + \ + replace( \ + replace_regex( \ + replace_regex(args, '\S*pkg/integration/tests/', ''), \ + '\.go( |$)', '${1}' \ + ), \ + " ", "$' && " + e2e-test-command + " -run 'TestIntegration/" \ + ) + "$'" \ + } }} + +# Run a single integration test with a visible UI; most useful with --sandbox or --slow. +e2e-cli *args: go run cmd/integration_test/main.go cli {{ args }} # Open the TUI for running integration tests. e2e-tui *args: go run cmd/integration_test/main.go tui {{ args }} -# Run all integration tests headlessly (without a visible UI). -e2e-all: - go test pkg/integration/clients/*.go - # Run some tests on the current commit, similar to what CI does. check: ./scripts/check_commit.sh