go build . or go run .task test or go test ./... (run single test: go test ./internal/llm/prompt -run TestGetContextFromPaths)go test ./... -update (regenerates .golden files when test output changes)
go test ./internal/tui/components/core -update (in this case, we're updating "core")task lint-fixtask fmt (gofumpt -w .)task dev (runs with profiling enabled)type AgentName string)fmt.Errorf for wrappingrequire package, parallel tests with t.Parallel(),
t.SetEnv() to set environment variables. Always use t.Tempdir() when in
need of a temporary directory. This directory does not need to be removed.When writing tests that involve provider configurations, use the mock providers to avoid API calls:
func TestYourFunction(t *testing.T) {
// Enable mock providers for testing
originalUseMock := config.UseMockProviders
config.UseMockProviders = true
defer func() {
config.UseMockProviders = originalUseMock
config.ResetProviders()
}()
// Reset providers to ensure fresh mock data
config.ResetProviders()
// Your test code here - providers will now return mock data
providers := config.Providers()
// ... test logic
}
goftumpt -w ..gofumpt is not available, use goimports.goimports is not available, use gofmt.task fmt to run gofumpt -w . on the entire project,
as long as gofumpt is on the PATH.