Documentation
¶
Overview ¶
Package strategies provides the strategy pattern implementation for test file parsing. Each test framework (Jest, Vitest, Playwright, Go testing) has its own strategy.
Index ¶
Constants ¶
const DefaultPriority = 100
DefaultPriority is the default priority for strategies. Higher priority strategies are checked first.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry manages registered strategies.
func DefaultRegistry ¶
func DefaultRegistry() *Registry
DefaultRegistry returns the global default registry.
func (*Registry) FindByName ¶ added in v1.1.0
FindByName returns the strategy with the given name.
func (*Registry) FindStrategy ¶
FindStrategy returns the first strategy that can handle the given file.
func (*Registry) GetStrategies ¶
GetStrategies returns a copy of all registered strategies.
type Strategy ¶
type Strategy interface {
// Name returns the strategy identifier (e.g., "jest", "vitest").
Name() string
// Priority returns the strategy priority (higher = checked first).
Priority() int
// Languages returns the languages this strategy supports.
Languages() []domain.Language
// CanHandle returns true if this strategy can parse the given file.
CanHandle(filename string, content []byte) bool
// Parse parses the source code and extracts test definitions.
Parse(ctx context.Context, source []byte, filename string) (*domain.TestFile, error)
}
Strategy defines the interface for test framework-specific parsers.
func FindStrategy ¶
FindStrategy returns the first matching strategy for the given file.
func FindStrategyByName ¶ added in v1.1.0
FindStrategyByName returns the strategy with the given name from the default registry.
func GetStrategies ¶
func GetStrategies() []Strategy
GetStrategies returns all registered strategies from the default registry.