leviosa-reporttosa-junit-to-html
v0.0.6
Published
Custom reporter to convert JUnit XML reports to HTML
Readme
🧪 Leviosa JUnit to HTML Report Generator
leviosa-reporttosa-junit-to-html is a CLI tool that parses JUnit XML reports (e.g., from WebdriverIO, Jest, Cypress, or any test runner generating standard JUnit XML) and generates a clean, interactive, Materialize-styled HTML report.
Designed for CI pipelines and local use — great for GitHub Actions with matrix strategy!
✨ Features
- ✅ Supports multiple JUnit XML files
- 🧩 Aggregates results from parallel test runs
- 💥 Highlights failed/error test cases
- 🖼 Displays failure screenshots (if provided)
- 🎨 Stylish, interactive UI using Materialize CSS
📦 Installation
bash
yarn add --dev leviosa-reporttosa-junit-to-htmlor
npm install --save-dev leviosa-reporttosa-junit-to-html🚀 CLI Usage
npx junit-test-reader <xml-directory> <output-html-path> [glob-pattern]Arguments Argument Description Directory containing JUnit XML files Path to write the final HTML report [glob-pattern] Optional glob for XMLs (default: **/*.xml) 📄 Example
npx junit-test-reader ./test-results ./report/index.html📸 Adding Screenshot Support
To embed screenshots in the report, append a line in your test failure message that looks like:
Screenshot: ./errorShots/my-failing-test.pngThis is typically done in a WebdriverIO afterTest hook:
if (error && typeof error.message === 'string') {
error.message += `\nScreenshot: ./errorShots/${test.title.replace(/\s+/g, '_')}.png`;
}💡 The reporter will automatically embed the image in the HTML report if this line exists.🧪 GitHub Actions Integration
This tool is especially useful with parallel jobs (matrix strategy). After uploading XML reports from each job, aggregate and generate the report:
- name: Install report generator
run: npm install leviosa-reporttosa-junit-to-html
- name: Merge XMLs and generate HTML report
run: npx junit-test-reader ./merged-results ./report/report.html