Socket
Socket
Sign inDemoInstall

playwright-e2e-coverage-report

Package Overview
Dependencies
0
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    playwright-e2e-coverage-report

Converts playwright e2e test report(json) to a hacky coverage report for use in code coverage


Version published
Weekly downloads
138
increased by48.39%
Maintainers
1
Install size
11.7 kB
Created
Weekly downloads
 

Readme

Source

playwright-e2e-coverage-report

Caution - not extensively tested. Share report files to help improve the solution.

Buy Me A Coffee

Description

This package is a hacky solution to an inconvenience found.

The incovenience

Playwright end2end test report structure uses suites and specs object array and code coverage report structure uses statement, branch and function mapping. This left me unable to use places like codecov etc. to be used as e2e coverage reporting places as well.

Where did I try it ?

In a CI where playwright e2e test report is generated which then is converted into code coverage format and uploaded to codecov.

Dashboard gymnastics

Here e2e tests are thought of as function coverage and are therefore under fnMap key of the final coverage report.

In dashboards, the header and their meanings would need some mental gymnastics as they are set to code coverage formats example -

e2etestcoverage
filefile
total no of teststracked lines
passedcovered
not implementedpartial
failmissed

NOTE: Only supports playwright json reporter.


Usage

In your CI pipeline eg. github actions add a step after the one which generates playwright test report.

Place after the step that generates playwright e2e test report.

- name: Convert E2E Report to Coverage Report
  run : |
    npm install playwright-e2e-coverage-report
    wget https://raw.githubusercontent.com/MandarDevarshi/playwright-e2e-coverage-report/master/scripts/reportConverter.js	
    chmod u+x reportConverter.js
    node ./reportConverter.js

The playwright report named e2eresults.json is to be generated or made available at project root by default, i.e when checked out in a CI. To make changes to report location and name set it in the script file reportConverter.js by saving it in your repository and removing the fetching of the script in the CI job.

Buy Me A Coffee

Keywords

FAQs

Last updated on 24 Mar 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc