Skip to content

Testing Integration

Detects your test framework, runs tests, parses results, and fixes failing tests via natural-language requests.

Detection runs in priority order — first match wins. Or override entirely with codebuddy.testCommand.

PriorityFrameworkDetected viaCommand
1Vitestpackage.json scripts / devDepsnpx vitest run
2Jestpackage.json scripts / devDepsnpx jest
3Mochapackage.json scripts / devDepsnpx mocha / npm test --
4Pytestpytest.ini, pyproject.toml, setup.pypython -m pytest
5Go testgo.modgo test ./...
6Cargo testCargo.tomlcargo test
fallbacknpm testpackage.json with a non-default test scriptnpm test --

Test-name filtering per framework:

FrameworkFlag
Jest--testNamePattern
Vitest-t
Mocha--grep
Pytest-k
Go-run
Cargo-- (pass-through)
run_tests({ testPath?: "src/auth/", testName?: "should validate token" })
  1. Detects framework (or uses your custom command).
  2. Spawns test process with shell: false.
  3. Parses output into structured results.
  4. Returns a markdown summary to the agent.

Result shape:

{
framework: "jest",
command: "npx jest src/auth/",
passed: 42,
failed: 3,
skipped: 1,
total: 46,
duration: "4.2s",
success: false,
failures: [
{
testName: "should validate expired token",
file: "src/auth/token.test.ts",
message: "Expected: false, Received: true",
expected: "false",
actual: "true"
}
]
}

Agent receives a formatted summary with pass/fail counts, up to 10 failure details, and the last 2000 chars of raw output.

Test-driven workflow specialist:

  1. Analyze — read code under test.
  2. Identify — determine needed test cases.
  3. Write — create/update test files.
  4. Run — via run_tests.
  5. Fix — patch failing code and re-run.

Invoked automatically in collaboration playbooks:

WorkflowChain
New featureArchitect → Reviewer → Developer → Tester → Reviewer
Bug fixDebugger → Developer → Tester
RefactorCode Analyzer → Architect → File Organizer → Developer → Tester

Tester has access to run_tests, edit_file, manage_terminal, ripgrep_search, get_diagnostics, list_files, search_vector_db, git, browser, plus MCP tools.

  • shell: false — args passed as array, no shell injection.
  • Arg sanitization — validated against shell metacharacters (;|&$(){}!<>), 500-char limit each.
  • Env — forced to FORCE_COLOR=0, CI=true for clean parseable output.
  • Custom command parsing — respects single + double quotes properly.
SettingDefaultPurpose
codebuddy.testCommand""Custom test command — overrides auto-detection
codebuddy.testTimeout120000Execution timeout (ms, 5000–600 000)
  • “Run the tests for the auth module”
  • “Run only the test named ‘should validate token’”
  • “Write tests for src/utils/parser.ts and run them”
  • “Fix the failing tests and make sure they all pass”
  • “Add unit tests for all exported functions in this file”