Documentation
¶
Overview ¶
Package engine assembles configuration, step packs, the match registry and the shared suite. Every command that works with steps (run, validate, steps, explain, mcp) builds on it so they always agree.
Index ¶
- Constants
- func Compiled() map[string]core.Pack
- func Register(key string, p core.Pack)
- type Engine
- func (e *Engine) AfterRun(ctx context.Context) []runner.RunError
- func (e *Engine) Close(ctx context.Context) error
- func (e *Engine) FeaturePaths(args []string) ([]string, map[string][]int, error)
- func (e *Engine) Init(ctx context.Context) error
- func (e *Engine) Interpolate(s string) string
- func (e *Engine) Invoke(sc *core.Scenario, text string, table *core.Table, doc *core.DocString) error
- func (e *Engine) LoadFeatures(paths []string) (*feature.Set, error)
- func (e *Engine) Manifests() map[string]core.Manifest
- func (e *Engine) PackNames() []string
- func (e *Engine) Plan(pickles []*feature.Pickle) *core.Plan
- func (e *Engine) Prepare(ctx context.Context, pickles []*feature.Pickle) error
- func (e *Engine) ResolvePath(p string) (string, error)
- func (e *Engine) ResolvePathFrom(dir, p string) (string, error)
- func (e *Engine) ResourceRoots() []string
- func (e *Engine) SearchDirs(dir string) []string
- func (e *Engine) SetProperties(told map[string]string)
- func (e *Engine) String() string
- type NamedPack
- type Options
Constants ¶
const ( CodePack = "AXX-E0300" CodeResource = "AXX-E0301" )
Error codes produced while assembling packs.
const CodeUnknownPack = "AXX-E0302"
CodeUnknownPack: axx-packs.yaml names a pack that is not compiled into this axx.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Engine ¶
type Engine struct {
// Declared is false for a project without axx-packs.yaml: it loads no
// packs.
Declared bool
Config *config.Config
Packs []NamedPack
Registry *match.Registry
Hooks []runner.PackHook
Suite *core.Suite
Logger *slog.Logger
// contains filtered or unexported fields
}
Engine is an assembled axx environment.
func (*Engine) AfterRun ¶
AfterRun lets packs implementing core.Finisher check the run as a whole; each returned error becomes a run error.
func (*Engine) FeaturePaths ¶
FeaturePaths resolves the feature paths to load: explicit CLI args (relative to the working directory) or run.paths (relative to the config directory, default "features").
func (*Engine) Interpolate ¶
Interpolate expands ${env:}/${sys:} references like configuration values.
func (*Engine) Invoke ¶
func (e *Engine) Invoke(sc *core.Scenario, text string, table *core.Table, doc *core.DocString) error
Invoke runs a step by text inside a scenario, for steps that are built from other steps.
A leading Gherkin keyword is ignored.
func (*Engine) LoadFeatures ¶
LoadFeatures parses features under paths (URIs relative to the config dir).
func (*Engine) Plan ¶
Plan matches the steps of the scenarios a run will execute, for packs implementing core.Preparer.
func (*Engine) Prepare ¶
Prepare runs the packs' before-the-apps-start setup (core.Preparer) with the plan of the given scenarios. Hosts call it before starting the apps.
func (*Engine) ResolvePath ¶
ResolvePath resolves a resource path referenced by a step (seed file, schema, payload): absolute paths are used as-is; relative paths are searched in `resources` roots and then the config directory.
func (*Engine) ResolvePathFrom ¶ added in v0.2.16
ResolvePathFrom resolves a path a feature file in dir names: next to the feature file first, then as ResolvePath.
func (*Engine) ResourceRoots ¶
ResourceRoots are the directories ResolvePath looks in, in order: the `resources` roots, then the config directory.
func (*Engine) SearchDirs ¶ added in v0.2.16
SearchDirs are the directories a path a feature file in dir names is looked for in, in order: dir (when not empty), then the ResourceRoots.
func (*Engine) SetProperties ¶ added in v0.6.2
SetProperties gives the steps the properties the services and hooks told axx (lifecycle.PropertiesEnv), as ${sys:name}: over axx.yaml's, under -D's.
type NamedPack ¶
NamedPack is a pack with its registration name.
func CompiledPacks ¶
func CompiledPacks() []NamedPack
CompiledPacks returns core and every pack compiled into this axx.
type Options ¶
type Options struct {
Config *config.Config
Logger *slog.Logger
// Packs overrides the pack list (tests and tools); nil means the
// project's axx-packs.yaml.
Packs []NamedPack
// Selection overrides the project's axx-packs.yaml (tests). When nil,
// the file next to axx.yaml is used; without one, no pack is loaded.
Selection []packset.Entry
// Compiled overrides the packs compiled into this axx (tests).
Compiled map[string]core.Pack
// IDE receives the lines packs announce to an IDE running axx; nil
// when none does.
IDE io.Writer
}
Options configures New.