When you need machine-readable test results for custom dashboards, CI/CD integrations, or downstream processing, wdio-json-reporter is the answer. It outputs WebdriverIO test results in clean, structured JSON format that you can feed into any system.
Why JSON Reports?
- Machine Readable — Parse and process results programmatically
- CI/CD Integration — Feed results into Jenkins, GitHub Actions, or custom pipelines
- Custom Dashboards — Build your own reporting UI on top of structured data
- Result Merging — Combine parallel execution results into a single file
- Multi-Version Support — Compatible with WDIO v4 through v7
WDIO Version Compatibility
| Reporter Version | WDIO Version |
|---|---|
| ^0.4.0 | v4 |
| ^1.0.0 | v5 |
| ^2.0.0 | v6 |
| ^3.0.0 | v7 |
Installation
npm install wdio-json-reporter --save-dev
Quick Start
Output to File
// wdio.conf.js
reporters: [
'dot',
['json', {
outputDir: './Results'
}]
]
Output to STDOUT
reporters: [
'dot',
['json', { stdout: true }]
]
Custom File Name
reporters: [
'dot',
['json', {
outputDir: './Results',
outputFileFormat: function(opts) {
return \`results-\${opts.cid}.\${opts.capabilities}.json\`
}
}]
]
Merging Parallel Results
With WDIO v5+, parallel workers each produce their own JSON file. For 2 suites across 2 browsers, you get 4 files instead of 1. The reporter includes a merge utility:
Using the onComplete Hook
// wdio.conf.js
onComplete: function (exitCode, config, capabilities, results) {
const mergeResults = require('wdio-json-reporter/mergeResults')
mergeResults('./Results', 'results-*', 'merged-results.json')
}
Via CLI
node mergeResults.js ./Results "wdio-json-*"
The merge outputs a single wdio-merged.json (or your custom filename) in the results directory.
WDIO v4 Configuration
For legacy WDIO v4 projects, the configuration is slightly different:
// wdio.conf.js (v4)
module.exports = {
reporters: ['dot', 'json'],
reporterOptions: {
outputDir: './Results',
combined: true // Single file output
}
}
CI Integration
# GitHub Actions
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- run: npm ci
- run: npx wdio run wdio.conf.ts
- uses: actions/upload-artifact@v4
with:
name: test-results
path: ./Results/wdio-merged.json
For the full documentation, visit the GitHub repo or the npm page.
Need help with test reporting? Feel free to reach out or open an issue on GitHub.