CLI command

critiq rules test

Run fixture-backed rule specs to prove expected rule behavior.

#Syntax

bash
critiq rules test [glob] [--format pretty|json]

#Arguments

  • glob: Optional spec glob. Defaults to **/*.spec.yaml.

#Flags

  • --format pretty|json: Output format. Defaults to pretty.

#Examples

bash
npx critiq rules test
npx critiq rules test ".critiq/rules/*.spec.yaml"
npx critiq rules test "packages/rules/**/*.spec.yaml" --format json

#Defaults

  • The default target is **/*.spec.yaml.

#JSON output

json
{
  "command": "rules test",
  "format": "json",
  "exitCode": 1,
  "target": "**/*.spec.yaml",
  "matchedFileCount": 1,
  "results": [],
  "diagnostics": []
}

#Exit behavior

  • 0: every matched spec passed.
  • 1: invalid arguments, failing specs, or diagnostics.
  • 2: internal/runtime errors.

#Notes

  • Specs should include invalid and valid fixtures for the rule behavior being described.