npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cypress-mochawesome-csv-united-report

v1.3.2

Published

CLI tool to generate a united CSV report from Cypress Mochawesome reports.

Downloads

174

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

Usage

  • Once installed, you can generate a CSV report by running the following command:
npx csv_report

Command Breakdown

  • csv_report: 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/csv_report.csv. If a file with that name already exists, a new file with a unique name (e.g., csv_report+1.csv, csv_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 csv_report will generate a CSV file at:

  • cypress/reports/csv_report.csv

  • The CSV file will include data from both JSON files, containing fields such as:

    • Day: Day of the test report.
    • 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).
    • Context: Additional context, if available.
    • Code: Test code snippet, if provided.
    • error: Error details, if any.

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.

If You have Errors while Installing or Running:**

Such as: The error message indicates that Node.js cannot find the cli.js file for the cypress-mochawesome-csv-united-report command. This could be due to a couple of reasons:

  • Incorrect Caching: Sometimes, npm might cache incorrectly. Try clearing the npm cache:

    npm cache clean --force

    Then, reinstall the package:

    npm install cypress-mochawesome-csv-united-report
  • Global vs. Local Installation: If you installed cypress-mochawesome-csv-united-report globally (using -g flag), but, using local installations within your project directory is generally recommended.

2. Running cypress-mochawesome-csv-united-report:

The package.json already defines a script named cypress-mochawesome-csv-united-report that should run the report generation functionality. You can use this instead of the full command:

npx csv_report

Additional Tips:

  • Check File Paths: Double-check the paths in your package.json to ensure they are accurate relative to your project structure.
  • Project Setup: Verify that you've run npm install after adding cypress-mochawesome-csv-united-report as a dependency to include it in your project's node_modules folder.

By following these steps and considering the alternative approaches for running the reporter, you should be able to successfully generate reports using cypress-mochawesome-csv-united-report.

License

  • This project is licensed under the Apache-2.0 License. See the LICENSE file for more details.

Author

  • Mohamed Said Ibrahim