{"id":15421729,"url":"https://github.com/mxschmitt/playwright-test-coverage","last_synced_at":"2025-04-05T07:02:33.360Z","repository":{"id":41642516,"uuid":"381736407","full_name":"mxschmitt/playwright-test-coverage","owner":"mxschmitt","description":"Playwright Test (@playwright/test) demo to collect coverage information via Istanbul","archived":false,"fork":false,"pushed_at":"2025-01-06T11:55:38.000Z","size":614,"stargazers_count":126,"open_issues_count":9,"forks_count":18,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-03-29T06:03:34.755Z","etag":null,"topics":["istanbul","playwright","playwright-test","react","vite","vitejs"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mxschmitt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-06-30T14:48:38.000Z","updated_at":"2025-03-18T22:02:52.000Z","dependencies_parsed_at":"2025-03-03T18:20:38.809Z","dependency_job_id":"f566fce6-136a-48dd-988c-1581860cfdf7","html_url":"https://github.com/mxschmitt/playwright-test-coverage","commit_stats":{"total_commits":10,"total_committers":6,"mean_commits":"1.6666666666666667","dds":0.5,"last_synced_commit":"794b49150c501691055121974e751d1456feaab6"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mxschmitt%2Fplaywright-test-coverage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mxschmitt%2Fplaywright-test-coverage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mxschmitt%2Fplaywright-test-coverage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mxschmitt%2Fplaywright-test-coverage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mxschmitt","download_url":"https://codeload.github.com/mxschmitt/playwright-test-coverage/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247299829,"owners_count":20916190,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["istanbul","playwright","playwright-test","react","vite","vitejs"],"created_at":"2024-10-01T17:35:42.398Z","updated_at":"2025-04-05T07:02:33.321Z","avatar_url":"https://github.com/mxschmitt.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Use [Istanbul](https://istanbul.js.org) coverage collection with [Playwright Test](https://playwright.dev/docs/test-intro)\n\n[![Coverage Status](https://coveralls.io/repos/github/mxschmitt/playwright-test-coverage/badge.svg)](https://coveralls.io/github/mxschmitt/playwright-test-coverage)\n[![CI](https://github.com/mxschmitt/playwright-test-coverage/actions/workflows/nodejs.yml/badge.svg)](https://github.com/mxschmitt/playwright-test-coverage/actions/workflows/nodejs.yml)\n\nThis example demonstrates how to use [vite-plugin-istanbul](https://github.com/ifaxity/vite-plugin-istanbul) to collect coverage data during runtime with your end-to-end tests which will be stored on the filesystem. When applying the shown parts, you are able to view the coverage report e.g. as HTML, or convert it to the `lcov` format for upload to [Coveralls](https://coveralls.io/) or other similar providers. In this example, we are using GitHub Actions to run the tests and upload them to Coveralls.\n\n## Prerequisites\n\n- The web application which you are using needs to have [`vite-plugin-istanbul`](https://github.com/ifaxity/vite-plugin-istanbul) configured during the build process.\n- It's recommended to only enable it during end-to-end testing, for example by checking a variable to determine if it should be enabled.\n- You could also add it only when the dev server `NODE_ENV=development` is used.\n\n## Usage\n\n- Place [`baseFixtures.ts`](https://github.com/mxschmitt/playwright-test-coverage/blob/main/e2e/baseFixtures.ts) into your test directory. Instead of requiring `@playwright/test` to get the test object, use `./baseFixtures`.\n- This will collect the corresponding coverage files into the `.nyc_output` directory which can be used from the [Istanbul CLI](https://github.com/istanbuljs/nyc).\n- For an example test, see [App.test.ts](/e2e/App.test.ts)\n\n## Coverage formats\n\nHelpful commands are the following:\n\n- `npx nyc report --reporter=html` -\u003e Writes an HTML report to `coverage/index.html`.\n- `npx nyc report --reporter=lcov` -\u003e commonly used to upload to Coveralls or [Codecov](https://about.codecov.io/).\n- `npx nyc report --reporter=text` -\u003e CLI output how the current code coverage per file and statement will look like.\n\n## Used tools\n\n- [vite](https://vitejs.dev/) - tooling and bundling for React\n- [vite-plugin-istanbul](https://github.com/ifaxity/vite-plugin-istanbul) - to add coverage information\n- [nyc](https://github.com/istanbuljs/nyc) - Istanbul CLI to generate lcov coverage\n\n## Using with [@playwright/experimental-ct-react](https://playwright.dev/docs/test-components)\n\nSee this version in the [`ct-react-vite`](https://github.com/mxschmitt/playwright-test-coverage/tree/ct-react-vite) branch.\n\n## Using create-react-app / Webpack\n\nSee this archived version in the [`create-react-app`](https://github.com/mxschmitt/playwright-test-coverage/tree/create-react-app) branch.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmxschmitt%2Fplaywright-test-coverage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmxschmitt%2Fplaywright-test-coverage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmxschmitt%2Fplaywright-test-coverage/lists"}