{"id":13651295,"url":"https://github.com/anishkny/playwright-test-coverage","last_synced_at":"2025-04-07T12:07:14.322Z","repository":{"id":39638913,"uuid":"402826634","full_name":"anishkny/playwright-test-coverage","owner":"anishkny","description":"Extends Playwright test to measure code coverage","archived":false,"fork":false,"pushed_at":"2024-05-09T22:08:33.000Z","size":1540,"stargazers_count":79,"open_issues_count":7,"forks_count":8,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-10-14T06:01:29.805Z","etag":null,"topics":["babel","coverage","istanbul","playwright"],"latest_commit_sha":null,"homepage":"https://npmjs.com/playwright-test-coverage","language":"JavaScript","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/anishkny.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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-09-03T16:05:34.000Z","updated_at":"2024-08-22T09:21:55.000Z","dependencies_parsed_at":"2023-02-12T21:01:33.545Z","dependency_job_id":"f6d74869-69bd-4743-b5e8-20472a2e167e","html_url":"https://github.com/anishkny/playwright-test-coverage","commit_stats":{"total_commits":122,"total_committers":3,"mean_commits":"40.666666666666664","dds":0.5,"last_synced_commit":"645f7bf2011036a4d85373f40866cc5fc0b558ea"},"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anishkny%2Fplaywright-test-coverage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anishkny%2Fplaywright-test-coverage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anishkny%2Fplaywright-test-coverage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anishkny%2Fplaywright-test-coverage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anishkny","download_url":"https://codeload.github.com/anishkny/playwright-test-coverage/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247648977,"owners_count":20972945,"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":["babel","coverage","istanbul","playwright"],"created_at":"2024-08-02T02:00:47.689Z","updated_at":"2025-04-07T12:07:14.297Z","avatar_url":"https://github.com/anishkny.png","language":"JavaScript","funding_links":[],"categories":["Utils"],"sub_categories":[],"readme":"# Playwright Test Coverage\n\n[![CI/CD](https://github.com/anishkny/playwright-test-coverage/actions/workflows/ci.yml/badge.svg)](https://github.com/anishkny/playwright-test-coverage/actions/workflows/ci-cd.yml)\n[![Depfu](https://badges.depfu.com/badges/94d21dacdb732bad55583672f138c7eb/overview.svg)](https://depfu.com/github/anishkny/playwright-test-coverage?project_id=32640)\n[![npm](https://img.shields.io/npm/v/playwright-test-coverage)](https://www.npmjs.com/package/playwright-test-coverage)\n[![npm](https://img.shields.io/npm/dw/playwright-test-coverage)](https://npmtrends.com/playwright-test-coverage)\n[![Awesome](https://awesome.re/badge.svg)](https://github.com/mxschmitt/awesome-playwright)\n\nA [Playwright](https://playwright.dev) extension that collects code coverage from running end-to-end tests. Assumes that code has been instrumented with [babel-plugin-istanbul](https://github.com/istanbuljs/babel-plugin-istanbul) during the build process.\n\n## Prerequisites\n\n- Playwright test framework\n- `babel-plugin-istanbul` plugin\n- `nyc` for running tests\n\n```bash\nnpm i -D @playwright/test babel-plugin-istanbul nyc\n```\n\n## Installation\n\n```bash\nnpm i -D playwright-test-coverage\n```\n\n## Usage\n\nWrite your Playwright tests as usual, except `require` `test` and `expect` from this package as follows:\n\n```js\n// tests/foo.spec.js\nconst { test, expect } = require(\"playwright-test-coverage\");\n\n// Use test and expect as usual\ntest(\"basic test\", async ({ page }) =\u003e {\n  await page.goto(\"https://playwright.dev/\");\n  const title = page.locator(\".navbar__inner .navbar__title\");\n  await expect(title).toHaveText(\"Playwright\");\n});\n```\n\nThen, instrument your front end source code for coverage using the `babel-plugin-istanbul` plugin.\n\nFinally, run your server via `nyc` to capture code coverage. For more details see [istanbul/nyc](https://github.com/istanbuljs/nyc).\n\n### Options\n\n- `ISTANBUL_TEMP_DIR` - Set this environment variable to specify where Istanbul coverage files should be output. Defaults to `$CWD/.nyc_output`.\n\n## Demo\n\nSee [anishkny/playwright-test-coverage-demo](https://github.com/anishkny/playwright-test-coverage-demo) or accompanying [blog post](https://dev.to/anishkny/code-coverage-for-a-nextjs-app-using-playwright-tests-18n7).\n\n## Contributing\n\nPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.\n\nPlease make sure to update tests as appropriate.\n\n## Acknowledgements\n\nInspired by [mxschmitt/playwright-test-coverage](https://github.com/mxschmitt/playwright-test-coverage).\n\n## License\n\n[MIT](https://choosealicense.com/licenses/mit/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanishkny%2Fplaywright-test-coverage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanishkny%2Fplaywright-test-coverage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanishkny%2Fplaywright-test-coverage/lists"}