Skip to content

Commit e7474f9

Browse files
committed
Document test-support feature: why it exists and how to run full test suite
Clarify in CLAUDE.md, PROJECT.md, code-reviewer, and plan-reviewer that make test/lint require --features test-support, that cfg(test) does not apply when the library is built as a dep for integration tests, and that plain cargo test skips integration tests.
1 parent e25f03e commit e7474f9

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

.claude/agents/code-reviewer.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Review code changes across five dimensions: **QA**, **Architecture Compliance**,
5656

5757
### Testing Verification — MANDATORY
5858

59-
- You MUST run `make test` to verify tests pass. You MUST flag ANY failure.
59+
- You MUST run `make test` to verify tests pass (runs `cargo test --features test-support`). Plain `cargo test` skips integration tests because `MockAzureDevOpsApi` is only generated when `test-support` is enabled. You MUST flag ANY failure.
6060
- You MUST verify tests exist for new/changed code: happy path, edge cases, failure modes. Flag missing tests as WARNING.
6161
- You MUST verify unit tests follow the project conventions:
6262
- `#[cfg(test)] mod tests` blocks within source files.
@@ -65,11 +65,12 @@ Review code changes across five dimensions: **QA**, **Architecture Compliance**,
6565
- `assert!`, `assert_eq!`, `assert_ne!` with descriptive messages.
6666
- `mockall` for trait-based mocking where applicable.
6767
- You MUST verify tests are independent (no execution order dependency) and clean up after themselves.
68+
- Integration tests live in `tests/*.rs` and use `MockAzureDevOpsApi`; they require `--features test-support` (included when running `make test`). Plans adding integration tests MUST enable this feature.
6869
- If ANY test is broken (even unrelated to the change): you MUST flag it.
6970

7071
### Linting Verification — MANDATORY
7172

72-
- You MUST run `make lint`. You MUST flag ANY violation in output (even unrelated) with the exact output.
73+
- You MUST run `make lint` (runs `cargo clippy --features test-support`). You MUST flag ANY violation in output (even unrelated) with the exact output.
7374
- You MUST flag ANY linting suppression (`#[allow(...)]` attributes, rules disabled in `clippy.toml`) that is not justified by a documented design decision. Flag as CRITICAL.
7475

7576
---

.claude/agents/plan-reviewer.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ Review the ENTIRE plan across five dimensions: **Structure & Ordering**, **QA Ad
8585
- `assert!`, `assert_eq!`, `assert_ne!` with messages.
8686
- `mockall` for trait-based mocking where applicable.
8787
- You MUST verify: integration tests (when planned) use mock servers and test utilities (not real external services).
88+
- **test-support feature**: Integration tests in `tests/*.rs` use `MockAzureDevOpsApi`. That mock is generated only when `test-support` is enabled (because `cfg(test)` is not active for the library when built as a dep for integration tests). Plans MUST use `make test` / `cargo test --features test-support` and MUST NOT assume plain `cargo test` runs integration tests.
8889

8990
### Linting Suppression — CRITICAL
9091

CLAUDE.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,8 @@ This project uses specialized subagents (defined in `.claude/agents/`) to enforc
214214
- Build (debug): `make build` (runs `cargo build`)
215215
- Build (release): `make release` (runs `cargo build --release`)
216216
- Check compilation: `make check` (runs `cargo check`)
217-
- Run all tests: `make test` (runs `cargo test`)
218-
- Lint: `make lint` (runs `cargo clippy -- -D warnings`)
217+
- Run all tests: `make test` (runs `cargo test --features test-support`). The `test-support` feature enables `mockall` and integration tests; without it, `cargo test` skips integration tests because `MockAzureDevOpsApi` is not generated when the library is compiled as a dependency.
218+
- Lint: `make lint` (runs `cargo clippy --features test-support -- -D warnings`)
219219
- Format: `make fmt` (runs `cargo fmt`)
220220
- All quality gates: `make all` (runs `fmt``lint``test``build`)
221221
- Clean: `make clean` (runs `cargo clean`)
@@ -251,6 +251,7 @@ This project uses specialized subagents (defined in `.claude/agents/`) to enforc
251251
- `AzureDevOpsApi` is defined in `src/azure/api_trait.rs` with `#[cfg_attr(feature = "test-support", mockall::automock)]`.
252252
- `AzureDevOpsClient` implements the trait by delegating to the standalone API functions.
253253
- Integration tests use `MockAzureDevOpsApi` (enabled via `test-support` feature) to verify tool behavior without external services.
254+
- **Why `test-support` feature?** `cfg(test)` is not active when the library is built as a dependency for integration tests (`tests/*.rs`), so `#[cfg_attr(test, mockall::automock)]` would never generate `MockAzureDevOpsApi`. A Cargo feature ensures the mock is generated whenever tests are run. Always use `make test` or `cargo test --features test-support` to run the full suite.
254255

255256
### Dependency injection
256257
- Pass dependencies explicitly via constructor parameters (`new()`).

docs/PROJECT.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Cargo workspace with two members:
4949

5050
| Crate | Version | Purpose |
5151
|---|---|---|
52-
| `mockall` | 0.12 | Trait-based test mocking |
52+
| `mockall` | 0.12 (optional, via `test-support` feature) | Trait-based test mocking for `MockAzureDevOpsApi`; required for integration tests |
5353

5454
### Codegen Crate (`mcp-tools-codegen`)
5555

@@ -106,8 +106,10 @@ MCP tool responses are optimized for LLM consumption:
106106
| `make build` | `cargo build` (debug) |
107107
| `make release` | `cargo build --release` |
108108
| `make check` | `cargo check` |
109-
| `make test` | `cargo test` |
110-
| `make lint` | `cargo clippy -- -D warnings` |
109+
| `make test` | `cargo test --features test-support` (unit + integration tests; see below) |
110+
| `make lint` | `cargo clippy --features test-support -- -D warnings` |
111+
112+
**test-support feature**: `mockall` and integration tests require the `test-support` feature because `cfg(test)` is not active when the library is built as a dependency for `tests/*.rs`. Without `--features test-support`, `cargo test` skips integration tests. Always use `make test` for the full suite.
111113
| `make fmt` | `cargo fmt` |
112114
| `make clean` | `cargo clean` |
113115
| `make all` | `fmt``lint``test``build` |

0 commit comments

Comments
 (0)