1.0.2 • Published 3 years ago

cypress-jest-coverage-merge v1.0.2

Weekly downloads
8
License
MIT
Repository
github
Last release
3 years ago

cypress-jest-coverage-merge

A helper to merge Cypress and Jest coverage reports into one report file.

This script is inspired by this example of merging Cypress & Jest reports: https://github.com/bahmutov/cypress-and-jest and https://github.com/transmissionsdev/merge-cypress-jest-coverag.

For better compatibility with multiple OS(Windows/Linux), this project uses nodejs APIs to handle files, such as copy/move/mkdir etc.

Usage

  1. Install
    npm i -D cypress-jest-coverage-merge
    Or
    yarn add -D cypress-jest-coverage-merge
  2. configure jest.config.js to set jest coverage report directory to tests/coverage/jest:
    ...
    // Indicates whether the coverage information should be collected while executing the test
    collectCoverage: true,
    // The directory where Jest should output its coverage files
    coverageDirectory: '<rootDir>/tests/coverage/jest',
    ...
  3. configure nyc in package.json to set Cypress coverage report directory to tests/coverage/cypress:
    ...
    "nyc": {
        "report-dir": "tests/coverage/cypress",
        "reporter": [
               "lcov",
               "json"
           ]
        }
    ...
  4. Run your Cypress tests and output coverage to a tests/coverage/cypress/ directory.
  5. Run your Jest tests and output coverage to a tests/coverage/jest directory.
  6. Run npx cypress-jest-coverage-merge and check the tests/coverage/reports directory for the merged report!
1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago