Standard Go tests without build tags.
go test ./...Require -tags=integration build tag. Located in cmd/p5/*_integration_test.go.
go test -tags=integration ./...Integration tests use teatest for TUI testing with mock Pulumi dependencies.
UI component snapshots in testdata/*.golden. Used for visual regression testing of UI components.
# Run with update flag to regenerate snapshots
go test ./internal/ui -updatego test ./... # Unit tests only
go test -tags=integration ./... # All tests
./scripts/coverage.sh # Coverage report
./scripts/coverage.sh -html # Open HTML reportLocated in internal/ui/ui_test.go. Test individual UI components (header, modals, lists) using golden file comparisons.
cmd/p5/integration_helpers_test.go provides:
testModel()- Creates model with fake dependenciesFakeStackOperator,FakeStackReader, etc. - Mock implementations- Golden file test utilities
internal/pulumi/fakes.go provides mock implementations of all Pulumi interfaces for testing without actual Pulumi operations.
Golden files capture expected terminal output. File naming convention:
testdata/TestFunctionName_SubTest.golden
Update snapshots only when UI changes are intentional:
go test ./internal/ui -update -run TestHeader