faf-taf-git

中文文档
2.4.6发布于 2026/11/03MITTypeScriptCommonJS

A Test Receipt Printer for git. Every CI run prints a receipt to .taf — append-only, timestamped, kept in git. Proof over time.

原始使用文档
文档目录12 节
  1. Why
  2. What a receipt looks like
  3. Set it up (GitHub Actions)
  4. Works with your test runner
  5. Other CI systems
  6. Read your receipts
  7. Settings
  8. How hard is it to fake?
  9. With FAF (optional)
  10. Upgrading from v1
  11. Develop
  12. License

faf-taf-git

TAF Claude Code Business card · Get yours →

A receipt printer for your tests.

Every time your tests run in CI, faf-taf-git writes a small receipt: when they ran, how many passed, failed and were skipped. The receipts are saved in your repo, one after another, on their own branch. Over time they show whether your tests really kept passing.

Anyone can get green once. Receipts show it over time.

npm: faf-taf-git · GitHub Action: Wolfe-Jam/faf-taf-git · MIT, free

Why

  • Test results usually vanish. CI shows today's run, then the log expires. Receipts stay.
  • You can look back. When did that test start failing? Was main green before the last release?
  • Other people can check. Users, reviewers, auditors and AI agents can read the history themselves instead of taking your word for it.

What a receipt looks like

Receipts are saved in a file called .taf, on a branch called taf-receipts:

- timestamp: 2026-10-29T20:28:58.090Z
  result: PASSED
  tests:
    total: 628
    passed: 621
    failed: 0
    skipped: 7
  trigger: github-actions

result is PASSED or FAILED. The full format is in RECEIPT-FORMAT.md.

Set it up (GitHub Actions)

Add this to a workflow, for example .github/workflows/tests.yml. Swap the install and test lines for your own.

name: Tests

on:
  push:
    branches: [main]
  pull_request:
  workflow_dispatch:

jobs:
  test:
    runs-on: ubuntu-latest
    permissions:
      contents: write              # lets the action save receipts

    steps:
      - uses: actions/checkout@v6
      - uses: actions/setup-node@v6
        with:
          node-version: '24.x'
      - run: npm ci

      - name: Run tests
        id: tests
        continue-on-error: true    # keep going, so a failed run still gets a receipt
        run: |
          set -o pipefail
          npm test 2>&1 | tee test-output.txt

      - name: Print the receipt
        if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
        uses: Wolfe-Jam/[email protected]
        with:
          test-output-file: test-output.txt
          target-branch: taf-receipts

      - name: Fail the job if the tests failed
        if: steps.tests.outcome == 'failure'
        run: exit 1

That's it. The first run creates the taf-receipts branch for you.

Four things this recipe gets right:

  1. Failed runs get a receipt too. A red run is recorded as FAILED, not left out. A history with only green runs proves less.
  2. Only main gets receipts. Pull requests and other branches still run the tests, but the record is about main.
  3. The job still goes red when tests fail, so your checks stay honest.
  4. Tests run once. The receipt reads the output of the run that just happened.

If your tests run on several operating systems, print the receipt from the one that runs the most tests.

Works with your test runner

RunnerWhat to give the action
Python (pytest)pytest --junitxml=report.xml, then test-output-file: report.xml
Any runner that writes JUnit XMLthe XML report file (Rust with cargo nextest, Go with gotestsum --junitfile, Java with Maven or Gradle, .NET, PHPUnit, Jest with jest-junit)
Jestthe console output (npm test 2>&1 | tee test-output.txt)
Vitestthe console output
Bunthe console output of bun test
WJTTCthe console output

JUnit XML is the common report format most test runners can write. If your runner isn't in the table, check whether it can write JUnit XML.

Other CI systems

The command-line tool does the same job anywhere Node.js runs (GitLab, Jenkins, CircleCI, Bitbucket, Azure, your own machine):

npm test 2>&1 | tee test-output.txt
npx faf-taf-git --file test-output.txt --commit

--commit commits the updated .taf for you. Leave it off to just update the file.

Read your receipts

git fetch origin taf-receipts
git show origin/taf-receipts:.taf

Make a badge for your README:

npx faf-taf-git badge --output badge.svg

Settings

Action inputs

InputWhat it doesDefault
test-output-fileThe file with your test output or JUnit XML reportrequired
target-branchThe branch receipts are saved to. Use taf-receipts.the current branch
auto-commitCommit and push the receipttrue
commit-messageThe commit messagechore(taf): update .taf receipt [skip ci]

Action outputs: result, passed, failed, skipped, total, taf-updated. For example, ${{ steps.taf.outputs.passed }}.

Command-line options: --file, --commit, --message, --cwd, --verbose. Run npx faf-taf-git --help for the full list.

How hard is it to fake?

Receipts are written by CI from the real test output and saved in git. Editing or deleting an old receipt changes the git history, so anyone comparing the history can see it. The taf-receipts branch only ever grows: never rewrite, squash or force-push it.

A receipt proves the tests passed on that commit. It does not prove a published package was built from that exact commit.

With FAF (optional)

faf-taf-git works on any git repo; you don't need anything else. If your project also uses FAF (a project.faf file describing the project for AI), the two fit together: project.faf says what the project is, and .taf shows its tests kept passing.

Upgrading from v1

v1 ran your tests inside the action. v2 reads a file your own test step wrote. Replace test-command: with a test step that saves its output, and point test-output-file: at that file (see the setup above).

Develop

npm ci
npm test          # the test suite
npm run build     # rebuilds dist/, which the action runs

See CONTRIBUTING.md and CHANGELOG.md.

License

MIT. Free forever.

If faf-taf-git is useful to you, a star helps other people find it.

版本与发布记录

faf-taf-git 共发布 12 个版本,首次发布于 2026/02/18;过去 12 个月发布了 12 个版本。

版本发布日期距今
2.4.6latest2026/11/03今天
2.4.52026/11/031 天前
2.4.42026/11/012 天前
2.4.32026/11/012 天前
2.4.22026/10/304 天前
2.4.12026/10/304 天前

关于 faf-taf-git 的常见问题

faf-taf-git 是什么?

用于git的测试收据打印机。每次CI运行都会打印收据给。只有附件,时间戳,保存在git中。时间证明。

如何安装 faf-taf-git?

在项目目录运行 npm install faf-taf-git,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 faf-taf-git,可以用 npx faf-taf-git 直接运行。

faf-taf-git 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

faf-taf-git 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

faf-taf-git 可以商用吗?

faf-taf-git 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

faf-taf-git 还在维护吗?

最新版本 2.4.6 发布于 2026/11/03(今天);至今共发布 12 个版本,其中过去 12 个月发布了 12 个;首次发布于 2026/02/18。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。