Skip to content

Template Tests

Leonard Ramminger edited this page Aug 22, 2026 · 2 revisions

Template Tests

Snapshot fixtures for regression tests in the template package.

Structure

templates/my_app/
  tests/
    default/
      answers.json          # input answers
      snapshot/             # expected output
    ci_enabled/
      answers.json
      snapshot/
      lock.json             # optional: lockfile snapshot

answers.json

Same format as --answers-file:

{
  "project_name": "Snapshot App",
  "project_slug": "snapshot-app",
  "namespace": "snapshot_ns",
  "include_ci": false
}

Run

tempify test basic_cpp
tempify test basic_cpp --fixture ci_enabled
tempify test basic_cpp --json

Create snapshots

  1. Render template with fixture answers
  2. Copy output to tests/<fixture>/snapshot/
  3. Optionally save .tempify-lock.json as lock.json

Reference: tests/test_templates/basic_cpp/tests/

What is compared?

  • Count and content of output files
  • Optional lockfile fingerprint (lock.json)

Differences → non-zero exit code and diff hint.

CI

Template tests run in the main test suite via TemplateTestRunner - see Tests & Quality.

See also

Your First Template · Template Quality

Clone this wiki locally