Files
harness-tools/extensions/native-hooks/skills/native-hook-authoring/references/testing.md
T

716 B

Policy testing

Work only in repository fixtures until activation is explicitly approved.

  1. Put policy fixtures in tests/fixtures/personal-config/policies/.
  2. Put ast-grep rules below tests/fixtures/personal-config/ast-grep/rules/ and keep severity below error.
  3. Cover TS and TSX positives, nearby negatives, the exact named suppression with a -- rationale, Unicode ranges, and malformed analyzer output where relevant.
  4. Assert multiple policies sharing one analyzer key cause one adapter invocation.
  5. Run:
npm run typecheck
npm test

Use /hooks-doctor only after authorized initialization. Never make a policy evaluator invoke ast-grep, a linter, LSP, shell, or Pi API directly.