Skip to content

quelltest in CI: gate pull requests with GitHub Actions

In CI, quelltest does three jobs on a pull request: quell gate fails the build when the change weakens tests, quell find --diff reports risky edges on the lines the pull request changed (and uploads them as code-scanning annotations), and quell score --threshold can enforce a minimum score. Everything runs offline on the runner; nothing is uploaded except what you choose to publish.

What does a pull-request workflow look like?

name: Quelltest
on: pull_request

permissions:
  contents: read
  security-events: write   # only needed for the SARIF upload

jobs:
  quelltest:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0          # the gate needs the merge-base with the target branch
      - uses: actions/setup-node@v4
        with:
          node-version: 22
          cache: npm
      - run: npm ci
      - name: Run tests with coverage
        run: npx jest --coverage --coverageReporters=json
      - name: Risky edges on changed lines
        run: >
          npx quell find src --diff "origin/${{ github.base_ref }}"
          --coverage coverage/coverage-final.json --sarif > quell.sarif
      - uses: github/codeql-action/upload-sarif@v3
        if: always()
        with:
          sarif_file: quell.sarif
      - name: Gate against weakened tests
        run: npx quell gate --diff "origin/${{ github.base_ref }}"

Why this shape:

  • fetch-depth: 0 is required: gate and --diff run git merge-base REF HEAD, which needs history. Without it git fails and the command exits 2.
  • Use coverage/coverage-final.json (Istanbul). An lcov.info with relative SF: paths is mis-resolved in 0.3.1; see limits. Any tool that writes Istanbul JSON works.
  • find --sarif prints SARIF 2.1.0 and exits 0 unless you add --threshold. Risk rules are reported at level warning, contract findings at level note.
  • Put the gate last, so the report and annotations are published even when the gate fails.
  • Use Node.js 20 or newer with quelltest 0.3.1. The next release requires 22.18+ or 24.11+, so pin node-version: 22 or higher if you plan to upgrade.

How do I enforce a minimum score?

      - run: npx quell score src --coverage coverage/coverage-final.json --threshold 60
Exit codeMeaning
0Score at or above the threshold (or no candidates at all).
1Score below the threshold.
3A threshold was given but there is no coverage evidence to score from.
2Usage, git or file error.

Scores are the share of candidates your tests execute: 80 and above is production-ready, 60 to 79 review-needed, below 60 edge-cases-uncovered. Start with a low threshold and raise it; with --diff REF the score covers only the lines the pull request changed.

How do I verify the tests a pull request touched?

verify runs your tests once per mutant, so run it on the test files that changed, not on the whole suite:

      - name: Verify the changed test
        run: npx quell verify tests/pay.test.js --source src/pay.js --runner jest --min-score 60 --handoff quell-handoff.md
      - uses: actions/upload-artifact@v4
        if: always()
        with:
          name: quelltest-handoff
          path: quell-handoff.md

A non-verified test exits 4. See how verify works. Add --timeout SECONDS on slow suites.

How do I get a job summary and a pull-request comment?

The quelltest repository's own workflow, .github/workflows/pr-report.yml, is a working example: it runs find --diff ... --json, renders the report into the job summary, uploads it as an artifact, updates a single marked pull-request comment (best effort, since fork pull requests have a read-only token), and runs the gate last with its output copied into the summary.

How do I run it outside GitHub?

Any CI that can run Node and git works. The contract is the exit codes: gate returns 5 on weakened tests, verify returns 4 when not verified, score --threshold returns 1 or 3. For JSON, use --json; for annotations, --sarif. All flags are in the CLI reference.

What about local hooks?

Run npx quell gate --diff origin/main in a pre-push hook, or give an agent the same check through the MCP server and Stop hook.