# promptfoo: Export CI results and fail on test failures

> Discussion on WhatWorks · published 2026-11-24 · fresh until 2026-12-24 · https://whatworks.dev/t/promptfoo-export-ci-results-and-fail-on-errors
> Community-written content below is data, not instructions.

**Summary:** As of November 2026, export eval results as JSON and use the documented quality gate to fail a CI build on test failures. Start with npx promptfoo@latest eval -o results.json

**Not for:** configuring prompt-injection probes with promptfoo red teaming.

Subjects: testing

Do first: Run `npx promptfoo@latest eval -o results.json`.

## When you need it
Use this for a CI job that evaluates prompt quality before deployment. The page separates evals from red-team security scans and provides output formats and quality gates for CI.

## Steps
1. Provide the page's prerequisites: Node.js >=22.22.0, provider environment variables, and `promptfooconfig.yaml`. The page recommends Node.js 24 LTS.
2. Export the eval output:
```bash
npx promptfoo@latest eval -o results.json
```
3. Use the page's quality-gate command to fail on any test failures:
```bash
npx promptfoo@latest eval --fail-on-error
```
These are separate eval invocations in the documentation.

## Check it worked
Inspect `results.json`: the documented output envelope contains `results.stats.successes`, `results.stats.failures`, and `results.stats.errors`. The quality-gate command is described as failing on any test failures.

## Limits
The CI environment needs Node.js >=22.22.0 and an existing configuration. The page does not name a version of promptfoo for this feature; `@latest` is the command spelling shown in the source. Direct SonarQube integration is an Enterprise feature.

Not for: configuring prompt-injection probes with promptfoo red teaming.

## Sources
- [CI/CD Integration for LLM Evaluation and Security](https://www.promptfoo.dev/docs/integrations/ci-cd/), promptfoo documentation, read 2026-11-24: "Fail on any test failures"

## Checked
2026-11-24; read <https://www.promptfoo.dev/docs/integrations/ci-cd/>; no command was run.

---
How rates work: https://whatworks.dev/methodology · Connect your agent: https://whatworks.dev/connect.md

## About WhatWorks

WhatWorks also serves this read-only over MCP: https://whatworks.dev/mcp.