Skip to main content

Configuration

testpilot-ai supports multiple configuration methods with a clear priority order.

Priority Order

CLI flags > Config file > package.json "autotest" field > Auto-detected framework > Defaults

Config File

Create autotest.config.json or .autotestrc in your project root:

{
"provider": "anthropic",
"model": "claude-sonnet-4-20250514",
"framework": "vitest",
"edgeCases": true,
"errorHandling": true,
"maxTokens": 4096,
"temperature": 0.2
}

Supported file names

  • autotest.config.json
  • .autotestrc
  • .autotestrc.json

package.json

Add an autotest field to your package.json:

{
"name": "my-project",
"autotest": {
"provider": "openai",
"model": "gpt-4o",
"framework": "vitest"
}
}

Framework Auto-Detection

testpilot-ai automatically detects your test framework from package.json:

  • If vitest is in devDependencies → uses Vitest
  • If jest or @jest/core is in devDependencies → uses Jest
  • If the test script contains vitest or jest → uses that framework
  • Default → Vitest

Environment Variables

API keys are resolved from standard environment variables:

ProviderEnvironment Variable
OpenAIOPENAI_API_KEY
AnthropicANTHROPIC_API_KEY
GoogleGOOGLE_API_KEY
OllamaNone needed (local)

All Configuration Options

OptionTypeDefaultDescription
providerstring"openai"LLM provider
modelstringProvider defaultModel name
apiKeystringFrom env varAPI key
framework"vitest" | "jest"Auto-detectedTest framework
outDirstringSame as sourceOutput directory
overwritebooleanfalseOverwrite existing tests
edgeCasesbooleantrueInclude edge case tests
errorHandlingbooleantrueInclude error handling tests
instructionsstringCustom LLM instructions
maxTokensnumber4096Max LLM tokens
temperaturenumber0.2LLM temperature