---
id: TASK-27.2
title: Add unit tests for runner verbosity paths and logging enablement
status: Done
assignee:
  - codex
created_date: '2026-03-03 09:14'
updated_date: '2026-03-03 09:29'
labels:
  - tests
  - coverage
dependencies: []
references:
  - src/core/exec.rs
  - src/core/log.rs
parent_task_id: TASK-27
---

## Description

<!-- SECTION:DESCRIPTION:BEGIN -->
Increase unit test coverage for core/exec runner branches and core/log enablement behavior based on the 2026-03-03 llvm-cov report.
<!-- SECTION:DESCRIPTION:END -->

## Acceptance Criteria
<!-- AC:BEGIN -->
- [x] #1 Runner::run covers verbose>=3 non-dry-run path (including reset_terminal_colors) with both success and failure exit statuses.
- [x] #2 Runner::run covers verbose==2 path with captured stdout/stderr and error conversion on non-zero exit.
- [x] #3 run_with_spinner path is exercised with a message (feature-agnostic) and succeeds.
- [x] #4 log::enabled returns false when verbosity < 2 and when KAZE_TESTING is set without KAZE_LOGS; returns true when KAZE_LOGS is set under testing.
- [x] #5 Environment variables modified in tests are restored to their prior state.
- [x] #6 All new tests pass with `cargo llvm-cov --lib --bins`.
<!-- AC:END -->

## Implementation Plan

<!-- SECTION:PLAN:BEGIN -->
1) Add exec tests for Runner verbosity branches: verbose>=3 success and failure (using `true`/`false`), verbose==2 failure with stdout/stderr (using `sh -c`), and run_with_spinner with a message (feature-agnostic).
2) Add log tests for `enabled()` gating when verbosity <2, when KAZE_TESTING is set without KAZE_LOGS, and when KAZE_LOGS is set; restore env vars after each test.
3) Run `cargo llvm-cov --lib --bins` to verify coverage and update acceptance criteria.
<!-- SECTION:PLAN:END -->

## Implementation Notes

<!-- SECTION:NOTES:BEGIN -->
Added exec tests for verbose>=3 success/failure, verbose==2 failure with stdout/stderr, and run_with_spinner success. Added log tests for enabled() verbosity + env gating with env restoration guard.

Ran `cargo llvm-cov --lib --bins --text --show-missing-lines --output-path /tmp/llvm-cov.txt` (106 unit tests + main test passed).
<!-- SECTION:NOTES:END -->
