Custom Jest reporter for Detox to generate JSON reports compatible with Grafana dashboards
npm install detox-json-reporterπ View Documentation on GitHub Pages
π A lightweight, TypeScript-powered JSON reporter for Detox end-to-end testing with Jest.
Generates structured detox-results.json files for analysis, dashboards (Grafana, Prometheus), or custom test pipelines.
---
- Generates rich JSON reports per test case
- Includes timestamps, durations, retries, platform & environment info
- Flaky test detection
- Works with Detox + Jest seamlessly
---
``bash`
yarn add -D detox-json-reporteror
npm install --save-dev detox-json-reporter
---
#### β€ Option 1: Use in jest.config.js
Add the reporter to your Jest configuration:
`bash`
module.exports = {
reporters: [
'default',
['detox-json-reporter', {
outputFile: './reports/detox-results.json' // optional path
}]
]
};
This will generate a file at ./reports/detox-results.json after running your Detox tests.
#### β€ Option 2: Use via Detox config (.detoxrc.js or package.json)
`bash`
{
"detox": {
"testRunner": "jest",
"runnerConfig": "e2e/config.json",
"reportSpecs": true,
"reporter": "detox-json-reporter"
}
}
This will instruct Detox to use the reporter automatically.
---
`json``
[
{
"testName": "Login flow should succeed",
"status": "passed",
"duration": 1325,
"file": "e2e/Login.test.ts",
"startedAt": "2025-06-26T10:25:00.123Z",
"endedAt": "2025-06-26T10:25:01.448Z",
"failureMessages": [],
"retries": 1,
"flaky": false,
"environment": {
"platform": "ios",
"hostPlatform": "darwin",
"hostname": "MacBook-Pro.local",
"osVersion": "24.1.0",
"cpuArch": "arm64"
}
}
]
---
- π Grafana dashboards (via JSON to Prometheus/Loki)
- CI pipeline debugging
- Flaky test monitoring
- Metrics analysis across test suites
---
FΓ‘bio Gomes - @fabiobhz
---
This project is licensed under the MIT License - see the LICENSE for details.