documentConfiguration

docs/configuration.md

Configuration

The configuration file tells requirements which definition files to load, how to run the linked tests, and which coverage the project must reach. Commands read requirements.yaml in the working directory; pass --config FILE to use another.

Example

$schema: https://raw.githubusercontent.com/k-kinzal/ztd-query-php/main/packages/requirements/schemas/config.schema.json
version: 1
definitions:
  - requirements/*.yaml
runners:
  unit:
    extension: phpunit
    command: [php, vendor/bin/phpunit]
  behavior:
    extension: behat
    command: [php, vendor/bin/behat]
coverage:
  minimum: 80

The runner names, here unit and behavior, are what definition files write in tests[].runner.

Fields

KeyRequiredDescription
versionyesAlways 1.
definitionsyesDefinition files to load, as PHP glob patterns. * does not cross directories. Every pattern must match at least one file; a file matched twice is loaded once.
$schemanoThe configuration schema, for lint and editors. See Schema.
bootstrapnoA PHP file loaded before anything else, usually vendor/autoload.php, so that custom extensions can be found.
extensions.sourcesnoCustom source formats, as name: Class. See extensions.
extensions.runnersnoCustom test runners, as name: Class. See extensions.
runners.<name>.extensionyesThe runner to use: phpunit, behat, or a registered custom runner.
runners.<name>.commandyesThe command as an argument list, for example [php, vendor/bin/phpunit]. It is never run through a shell.
runners.<name>.cwdnoWorking directory of the command. Default ..
runners.<name>.timeoutnoTimeout in seconds. Default 60.
coverage.minimumnoMinimum source coverage in percent that coverage requires. Default 0.
coverage.diff_minimumnoMinimum coverage in percent of the units that are new or changed since a snapshot. Default 0. See CI.
coverage.sources.<id>noMinimum coverage in percent for one source, by source ID.
markdown.experimentalnoSet to true to allow Markdown definition files. See definitions.

Relative paths are resolved from the directory of the configuration file, including paths written inside definition files. Unknown keys fail lint.

The bootstrap file and extension classes are project code: requirements runs them the same way it runs your test suite.

Schema

The $schema URI above resolves to the schema installed with the package, so lint works offline. A relative path such as ./team.schema.json adds a local JSON Schema on top of the bundled one; it cannot weaken it.

Editors that use YAML Language Server read the schema from a # yaml-language-server: $schema=... comment or from an editor setting. Prefer the editor setting if you run requirements format, because it removes comments.