cypress-mochawesome-csv-united-report
v1.2.3
Published
CLI tool to generate a united CSV report from Cypress Mochawesome reports.
Downloads
724
Maintainers
Keywords
Readme
Cypress Mochawesome CSV United Report
Cypress Mochawesome CSV United Report is a command-line tool that merges all Cypress Mochawesome JSON reports into a customized CSV file. The reports should be located in the cypress/reports
folder within a Cypress project.
Features
- Merges multiple JSON files into one CSV report.
- Automatically handles file naming conflicts for CSV output.
- Extracts relevant data from Mochawesome reports (time, suite, test case, pass/fail status, etc.).
- Customizable delimiter for CSV formatting.
Prerequisites
- Node.js version 14.0.0 or higher.
- Typescript setup in your project (if you're modifying the source code).
Installation
To install the package locally, run the following command in your Cypress project root:
npm install cypress-mochawesome-csv-united-report
- To Install it globally
npm install -g cypress-mochawesome-csv-united-report
Usage
- Once installed, you can generate a CSV report by running the following command:
npx cmur
Command Breakdown
- cmur: This will merge all the JSON files located in the cypress/reports directory and create a CSV report.
Custom CSV File Location
- By default, the merged CSV file will be saved to cypress/reports/cmur_report.csv. If a file with that name already exists, a new file with a unique name (e.g., cmur_report+1.csv, cmur_report+2.csv, etc.) will be created automatically.
Example
Assuming your cypress/reports directory contains the following Mochawesome JSON files:
- cypress/reports/test-results-1.json
- cypress/reports/test-results-2.json
Running npx cmur will generate a CSV file at:
cypress/reports/cmur_report.csv
The CSV file will include data from both JSON files, containing fields such as:
- time: Timestamp of the test report.
- suite: Test suite name.
- test_case: Individual test case name.
- duration: Duration of the test.
- speed: Speed of the test execution.
- state: Test state (passed, failed, pending).
- pass: Count of passed tests.
- fail: Count of failed tests.
- pending: Count of pending tests.
- context: Additional context, if available.
- code: Test code snippet, if provided.
- err: Error details, if any.
- isHook: Indicates if the test is a hook.
- skipped: Whether the test was skipped.
CSV Formatting
- The default delimiter used in the CSV file is the Star Symbol (*) . You can modify this by adjusting the source code.
- The generated CSV will escape the delimiter and any newlines in the fields to ensure proper formatting.
License
- This project is licensed under the MIT License. See the LICENSE file for more details.
Author
- Mohamed Said Ibrahim