codespeak test
Run tests and iteratively fix failures.
Synopsis
codespeak test [spec_path] [--auto-configure] [--max-iterations N] [--no-interactive]Description
Runs the project's test suite, and if tests fail, uses Claude to analyze the failures and fix the code. Repeats until all tests pass or the maximum number of iterations is reached.
Use --auto-configure to let CodeSpeak detect and save the test runner command to codespeak.json (it configures and exits without running tests).
Flags
| Flag | Description |
|---|---|
spec_path | Path to the specification file. If omitted, all registered specs are tested |
--auto-configure | Auto-detect and configure the test runner command for a spec. Mutually exclusive with --max-iterations |
--max-iterations N | Maximum number of test fix iterations (default: 3, max: 30) |
--no-interactive | Run in non-interactive mode without real-time progress updates |
Error messages
| Error | Cause | Resolution |
|---|---|---|
| Can't find spec to build | No .cs.md files found and no specs registered in codespeak.json | Create a spec file or register one in codespeak.json |
| Cannot specify both a positional spec path and --spec | Both positional path and --spec flag provided | Use one or the other |
| Anthropic API Key not found | No API key configured | Set the ANTHROPIC_API_KEY environment variable or run through the interactive setup |
| Circular spec dependency detected: A -> B -> A | Spec imports form a cycle | Remove the circular import |
| {path} does not belong to a CodeSpeak project | No codespeak.json found | Run codespeak init first |
| --max-iterations must be between 1 and 30 | Invalid iteration count | Use a value between 1 and 30 |
| A placeholder test runner configuration was added to codespeak.json | No test runner config exists for the spec | Run codespeak test --auto-configure or manually edit codespeak.json |
| The test runner configuration still has placeholder values | Config fields still start with "TODO:" | Replace placeholder values in codespeak.json |
| The 'run_all_tests_command' must include {tests_report_file} placeholder | Required macro missing from command | Add the macro to the command string in codespeak.json |
| Test runner command failed to start | Configured command produces a shell error | Fix the command in codespeak.json |
| Failed to fix all tests after N iterations | Iterations exhausted with remaining failures | Increase --max-iterations or fix tests manually |
| Failed to auto-detect test runner commands | Auto-configure couldn't find a test runner | Manually configure in codespeak.json |
See also
codespeak coverage— improve test coveragecodespeak build— full build including tests