yield/Documentation

Testing / Deterministic effects

Make fixture side effects explicit.

yskill test runs commands for real. Fixture hooks prepare only the state a saved agent or user response would have changed.

01 / Configure

Declare setup, response effects, and cleanup.

fixtures/test.json
{
  "version": 1,
  "setup": [["node", "fixtures/setup.mjs"]],
  "after_response": {
    "approve": [["node", "fixtures/apply-approval.mjs"]]
  },
  "teardown": [["node", "fixtures/teardown.mjs"]]
}
02 / Input

Read the accepted response from standard input.

Each after_response command receives that fixture response as JSON on stdin. Hooks run without a shell.

fixtures/apply-approval.mjs
const chunks = []
for await (const chunk of process.stdin) chunks.push(chunk)
const response = JSON.parse(Buffer.concat(chunks).toString())

if (response.value !== "yes") process.exit(1)
// Create only the deterministic state the approved step needs.
03 / Lifecycle

Cleanup runs after success or failure.

  • Setup runs firstPrepare isolated fixture state before the workflow starts.
  • Response effects run after admissionChange state only after Yield accepts the named answer.
  • Teardown always runsRemove test state after a completed or failed test.
  • Every hook gets YIELD_FIXTURE=1Keep test-only behavior out of live runs.
Keep the workflow real.Hooks should prepare or clean fixture state. They should not replace the workflow behavior being tested.

Rust: fixture helpers may add another binary under src/bin/. New workflows name the primary workflow binary in skill.json, so Cargo runs the workflow without asking you to choose one.