{"id":19612043,"url":"https://github.com/fnndsc/playwright-test-coverage-native","last_synced_at":"2025-04-27T22:33:55.252Z","repository":{"id":218598055,"uuid":"746707543","full_name":"FNNDSC/playwright-test-coverage-native","owner":"FNNDSC","description":"Extends Playwright test to measure code coverage using Playwright's built-in features","archived":false,"fork":false,"pushed_at":"2024-02-07T04:53:17.000Z","size":14,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":7,"default_branch":"main","last_synced_at":"2024-11-02T09:15:58.932Z","etag":null,"topics":["coverage","playwright","v8"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/playwright-test-coverage-native","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/FNNDSC.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":"2024-01-22T14:14:28.000Z","updated_at":"2024-05-08T17:53:57.000Z","dependencies_parsed_at":"2024-02-07T05:44:34.925Z","dependency_job_id":"cfc91968-ab7e-4946-8e89-a6e64eed5e23","html_url":"https://github.com/FNNDSC/playwright-test-coverage-native","commit_stats":null,"previous_names":["fnndsc/playwright-test-coverage-native"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FNNDSC%2Fplaywright-test-coverage-native","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FNNDSC%2Fplaywright-test-coverage-native/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FNNDSC%2Fplaywright-test-coverage-native/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FNNDSC%2Fplaywright-test-coverage-native/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FNNDSC","download_url":"https://codeload.github.com/FNNDSC/playwright-test-coverage-native/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251219600,"owners_count":21554444,"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":["coverage","playwright","v8"],"created_at":"2024-11-11T10:45:44.561Z","updated_at":"2025-04-27T22:33:50.237Z","avatar_url":"https://github.com/FNNDSC.png","language":"JavaScript","readme":"# playwright-test-coverage-native\n\n[![License](https://img.shields.io/npm/l/playwright-test-coverage-native)](https://github.com/FNNDSC/playwright-test-coverage-native/blob/main/LICENSE)\n[![Version](https://img.shields.io/npm/v/playwright-test-coverage-native)](https://www.npmjs.com/package/playwright-test-coverage-native)\n\nMeasure test coverage with Playwright.\nIts only dependency is `@playwright/test` — unlike its [alternatives](#alternatives), `playwright-test-coverage-native` uses Playwright's \n[built-in coverage functionality](https://playwright.dev/docs/api/class-coverage) without [Istanbul](https://istanbul.js.org/).\n\n## Installation\n\nUsing NPM:\n\n```shell\nnpm i -D playwright-test-coverage-native\n```\n\nUsing [PNPM](https://pnpm.io/):\n\n```shell\npnpm i -D playwright-test-coverage-native\n```\n\n## Configuration\n\nAdd `coverageDir` to `playwright.config.ts` to set where coverage data should be written to.\nFor example,\n\n```ts\nimport { defineConfig, devices } from \"playwright-test-coverage-native\";\n\n// See https://playwright.dev/docs/test-configuration.\nexport default defineConfig({\n  projects: [\n    {\n      name: \"chromium\",\n      use: {\n        ...devices[\"Desktop Chrome\"],\n        coverageDir: './coverage/tmp',  // output location for coverage data\n        coverageSrc: './src',           // filter coverage data for only files in ./src (optional)\n        // one of: '@fs', 'localhosturl'. Sadly you'll just have to play around to see which one works\n        coverageSourceMapHandler: '@fs'\n      },\n    },\n  ],\n});\n```\n\n\u003e [!NOTE]  \n\u003e Coverage APIs are only supported on Chromium-based browsers.\n\n## Usage\n\n`playwright-test-coverage-native` is a drop-in replacement for `@playwright/test`. Edit the import of your test files like this:\n\n```diff\n-import { test, expect } from '@playwright/test';\n+import { test, expect } from 'playwright-test-coverage-native';\n```\n\nIf you're brave, you can do the changes in bulk:\n\n```shell\n# using GNU coreutils\nfind -type f -name '*.test.?s' -exec sed -i -e 's#@playwright/test#playwright-test-coverage-native#' \\;\n```\n\n## Post-processing\n\nInstall [c8](https://www.npmjs.com/package/c8).\n\nAfter running `playwright test -c playwright.config.ts`,\nrun `c8 report` to print a summary of the coverage.\n`c8 report` is also used to convert to various formats,\nsee `c8 report --help` for more options.\n\n## Alternatives\n\n\u003e [!NOTE]  \n\u003e V8 code coverage can be inaccurate due to JavaScript code transformation and source maps,\n\u003e in which case alternatives (which use istanbul) may be preferable.\n\n- https://github.com/anishkny/playwright-test-coverage (requires [babel-plugin-istanbul](https://github.com/istanbuljs/babel-plugin-istanbul) instrumentation)\n- https://github.com/mxschmitt/playwright-test-coverage (requires [vite-plugin-istanbul](https://github.com/ifaxity/vite-plugin-istanbul))\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffnndsc%2Fplaywright-test-coverage-native","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffnndsc%2Fplaywright-test-coverage-native","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffnndsc%2Fplaywright-test-coverage-native/lists"}