# How to Run the e2e Test Suite Locally with `make e2e`

> Learn how to run the e2e test suite locally using `make e2e` in the kunchenguid/no-mistakes repository. Execute tests in a simulated environment without real network calls.

- Repository: [Kun Chen/no-mistakes](https://github.com/kunchenguid/no-mistakes)
- Tags: how-to-guide
- Published: 2026-07-03

---

**Running `make e2e` builds the real `no-mistakes` binary and a fake-agent binary, then executes end-to-end tests in an isolated temporary environment that simulates the full development pipeline without making real network calls.**

The `no-mistakes` repository by kunchenguid implements a comprehensive end-to-end testing strategy that validates the complete workflow—from repository initialization through CI simulation—by driving the actual CLI binary against a controlled fake agent. Understanding how to run the e2e test suite locally with `make e2e` ensures you can verify changes safely without affecting real Git configurations or API credentials.

## What the e2e Suite Validates

The **e2e** suite exercises the entire pipeline by executing real commands against a temporary Git repository. According to the source code in [`internal/e2e/journey_test.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/e2e/journey_test.go), the tests cover:

- **Repository initialization** (`init`)
- **Branch rebasing** (`rebase`)
- **Code review** (`review`)
- **Test execution** (`test`)
- **Documentation generation** (`document`)
- **Linting** (`lint`)
- **Push operations** (`push`)
- **Pull request creation** (`PR`)
- **CI simulation** (`CI`)

The harness uses a **fake-agent binary** ([`cmd/fakeagent/main.go`](https://github.com/kunchenguid/no-mistakes/blob/main/cmd/fakeagent/main.go)) that intercepts agent calls for Claude, Codex, and OpenCode, preventing real API requests while recording every invocation for assertions.

## Running the Full Suite

Execute the complete end-to-end test suite with a single command:

```bash
make e2e

```

This command triggers the `e2e` target defined in the `Makefile` at lines 60–62:

```make

# end‑to‑end suite: drives the real no-mistakes binary against a fake agent

e2e:
	go test -tags=e2e -count=1 -timeout 300s ./internal/e2e/... ./internal/pipeline/steps/...

```

The `-tags=e2e` flag ensures Go compiles only the e2e packages and pipeline-step packages containing e2e tests. The `-count=1` flag disables test caching, guaranteeing fresh execution.

### Expected Output

A successful run produces output similar to:

```bash
=== RUN   TestUserJourney/claude
--- PASS: TestUserJourney/claude (30.12s)
=== RUN   TestUserJourney/codex
--- PASS: TestUserJourney/codex (29.85s)
=== RUN   TestUserJourney/opencode
--- PASS: TestUserJourney/opencode (30.04s)
PASS
ok  	github.com/kunchenguid/no-mistakes/internal/e2e	90.123s
ok  	github.com/kunchenguid/no-mistakes/internal/pipeline/steps	4.567s

```

## How the Test Harness Works

The [`internal/e2e/harness.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/e2e/harness.go) file implements a three-phase process that isolates all test state from your real environment.

### Phase 1: Binary Compilation

The `buildBinaries` helper function compiles both required binaries exactly once per `go test` process:

- **[`cmd/no-mistakes/main.go`](https://github.com/kunchenguid/no-mistakes/blob/main/cmd/no-mistakes/main.go)** – The actual CLI entry point
- **[`cmd/fakeagent/main.go`](https://github.com/kunchenguid/no-mistakes/blob/main/cmd/fakeagent/main.go)** – The mock agent that simulates AI responses

The harness executes `go build -o <tmp>/no-mistakes ./cmd/no-mistakes` and `go build -o <tmp>/fakeagent ./cmd/fakeagent`, storing binaries in the temporary directory.

### Phase 2: Isolated Environment Setup

The `NewHarness` constructor creates a completely isolated workspace:

1. **Temporary directory tree** – Creates fresh `$NM_HOME` and `$HOME` directories
2. **Git repository simulation** – Initializes a bare upstream repository and a working clone
3. **Agent symlinks** – Creates symlinks for `claude`, `codex`, and `opencode` pointing to the fake-agent binary
4. **Stub commands** – Installs a stub `gh` command to intercept GitHub CLI calls
5. **Daemon startup** – Launches the daemon with `NM_TEST_START_DAEMON=1` using the per-run global config that forces `agent_path_override` to the fake-agent binary

### Phase 3: Test Execution

Tests like `TestUserJourney` in [`internal/e2e/journey_test.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/e2e/journey_test.go) execute the workflow:

1. Call `h.Run("init")` to initialize the repository
2. Execute `h.PushToGate("<branch>")` to trigger pipeline steps
3. Poll the daemon via IPC using `h.WaitForRun` until the run completes
4. Verify recorded fake-agent invocations against expected behavior

## Running Individual e2e Tests

To run a specific scenario (e.g., only the Claude agent), use standard `go test` syntax with the `e2e` build tag:

```bash
go test -tags=e2e -run '^TestUserJourney/claude$' ./internal/e2e

```

This approach is useful for debugging specific agent behaviors without waiting for the full suite to complete.

## Key Source Files

Understanding these files helps when debugging test failures or extending the suite:

- **`Makefile`** (lines 60–62) – Defines the `e2e` target and build flags
- **[`internal/e2e/harness.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/e2e/harness.go)** – Contains `NewHarness`, `buildBinaries`, and IPC polling logic
- **[`internal/e2e/journey_test.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/e2e/journey_test.go)** – Implements `TestUserJourney` covering the full pipeline
- **`internal/pipeline/steps/*_e2e_test.go`** – Step-specific end-to-end tests for individual pipeline components
- **[`cmd/no-mistakes/main.go`](https://github.com/kunchenguid/no-mistakes/blob/main/cmd/no-mistakes/main.go)** – CLI entry point built for testing
- **[`cmd/fakeagent/main.go`](https://github.com/kunchenguid/no-mistakes/blob/main/cmd/fakeagent/main.go)** – Mock agent that records invocations for assertions

## Summary

- **`make e2e`** executes the full end-to-end suite by running `go test -tags=e2e` with a 300-second timeout
- The **test harness** in [`internal/e2e/harness.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/e2e/harness.go) compiles real binaries but isolates them in temporary directories with fake agents
- **Three AI agents** (Claude, Codex, OpenCode) are tested via symlinks to the fake-agent binary
- **No real network calls** occur—the stub `gh` command and fake agents intercept all external operations
- **Individual tests** can target specific agents using `-run '^TestUserJourney/claude$'` with the `e2e` build tag

## Frequently Asked Questions

### What does the e2e test suite actually validate?

The suite validates the complete developer workflow from repository initialization through CI simulation. It exercises the real `no-mistakes` binary against a controlled Git environment, ensuring that commands like `init`, `rebase`, `review`, and `push` execute correctly when integrated with the daemon and agent subsystem.

### Do I need real API keys or Git credentials to run make e2e?

No. The harness in [`internal/e2e/harness.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/e2e/harness.go) creates a stub `gh` command and symlinks `claude`, `codex`, and `opencode` to a fake-agent binary. This intercepts all API calls and GitHub CLI operations, allowing the suite to run completely offline without requiring real credentials or network access.

### How long does the e2e suite take to complete?

The Makefile specifies a 300-second timeout (`-timeout 300s`), and typical runs complete in approximately 90 seconds for the main journey tests plus additional time for pipeline step tests. Individual agent scenarios (Claude, Codex, OpenCode) each take roughly 30 seconds depending on system performance.

### Where are the test binaries stored during execution?

The `buildBinaries` function stores compiled binaries in a temporary directory created by the test harness. These binaries—`no-mistakes` and `fakeagent`—are built once per `go test` process and automatically cleaned up when the test completes, leaving no artifacts in your working directory or `GOPATH`.