{"id":47732281,"url":"https://github.com/pokujs/c8","last_synced_at":"2026-06-09T19:00:16.488Z","repository":{"id":298011623,"uuid":"998548294","full_name":"pokujs/c8","owner":"pokujs","description":"☔️ Facilitator utility for coverage with c8 using Poku.","archived":false,"fork":false,"pushed_at":"2026-06-09T17:18:41.000Z","size":173,"stargazers_count":2,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-06-09T18:22:42.257Z","etag":null,"topics":["c8","coverage","poku"],"latest_commit_sha":null,"homepage":"https://poku.io/docs/documentation/plugins/official/coverage","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/pokujs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["wellwelwel"]}},"created_at":"2025-06-08T20:57:55.000Z","updated_at":"2026-06-09T17:22:26.000Z","dependencies_parsed_at":"2025-06-08T23:25:56.755Z","dependency_job_id":"42a67ba7-f207-4a37-87da-5830d78e2cb1","html_url":"https://github.com/pokujs/c8","commit_stats":null,"previous_names":["pokujs/c8"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/pokujs/c8","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pokujs%2Fc8","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pokujs%2Fc8/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pokujs%2Fc8/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pokujs%2Fc8/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pokujs","download_url":"https://codeload.github.com/pokujs/c8/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pokujs%2Fc8/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34121022,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-09T02:00:06.510Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["c8","coverage","poku"],"created_at":"2026-04-02T21:49:35.495Z","updated_at":"2026-06-09T19:00:16.338Z","avatar_url":"https://github.com/pokujs.png","language":"TypeScript","funding_links":["https://github.com/sponsors/wellwelwel"],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\u003cimg height=\"180\" alt=\"Poku's Logo\" src=\"https://raw.githubusercontent.com/wellwelwel/poku/main/.github/assets/readme/poku.svg\"\u003e\n\n# @pokujs/c8\n\nEnjoying **Poku**? [Give him a star to show your support](https://github.com/wellwelwel/poku) ⭐\n\n\u003c/div\u003e\n\n---\n\n📚 [**Documentation**](https://poku.io/docs/documentation/helpers/coverage/c8)\n\n\u003c/div\u003e\n\n---\n\n☔️ [**@pokujs/c8**](https://github.com/pokujs/c8) is a **Poku** plugin for **V8** code coverage using [**c8**](https://github.com/bcoe/c8).\n\n\u003e [!TIP]\n\u003e\n\u003e **@pokujs/c8** supports **JSONC** config files (`.c8rc`, `.nycrc`, etc.) out of the box, allowing comments in your configuration. You can also use **JS** and **TS** by setting the options directly in the plugin.\n\n---\n\n## Quickstart\n\n### Install\n\n```bash\nnpm i -D @pokujs/c8\n```\n\n### Usage\n\n#### Enable the Plugin\n\n```js\n// poku.config.js\nimport { coverage } from '@pokujs/c8';\nimport { defineConfig } from 'poku';\n\nexport default defineConfig({\n  plugins: [coverage()],\n});\n```\n\nRun `poku` and a coverage summary will be printed after your test results.\n\n\u003e [!IMPORTANT]\n\u003e\n\u003e This plugin relies on **Node.js**' built-in `NODE_V8_COVERAGE` environment variable to collect coverage data. **Bun** and **Deno** do not support this mechanism, so coverage data will not be collected when running tests with these runtimes.\n\n---\n\n## Options\n\n```js\ncoverage({\n  // Config file (.c8rc, .c8rc.json, .c8rc.jsonc, .nycrc, .nycrc.json, .nycrc.jsonc)\n  config: '.c8rc', // default: auto-discover\n\n  // Activation\n  requireFlag: true, // default: false\n\n  // Reporters (clover, cobertura, html, html-spa, json, json-summary, lcov, lcovonly, none, teamcity, text, text-lcov, text-summary)\n  reporter: ['text', 'lcov'], // default: ['text']\n\n  // File selection\n  include: ['src/**'], // default: [] (all files)\n  exclude: ['**/*.test.ts'], // default: c8 defaults\n  extension: ['.ts', '.js'], // default: c8 defaults\n\n  // Thresholds\n  checkCoverage: true, // default: false\n  lines: 80, // default: 0\n  branches: 80, // default: 0\n  functions: 80, // default: 0\n  statements: 80, // default: 0\n  perFile: false, // default: false\n\n  // Include untested files\n  all: true, // default: false\n  src: ['src'], // default: [cwd]\n\n  // Experimental\n  experimental: ['monocart'], // default: []\n\n  // Output\n  reportsDirectory: './coverage', // default: './coverage'\n  skipFull: false, // default: false\n\n  // Advanced\n  watermarks: { lines: [80, 95], branches: [80, 95] }, // default: c8 defaults\n  excludeAfterRemap: false, // default: false\n  mergeAsync: false, // default: false\n  clean: true, // default: true\n});\n```\n\n---\n\n## Examples\n\n### Basic text coverage\n\n```js\ncoverage({\n  include: ['src/**'],\n});\n```\n\n### Generate HTML and LCOV reports\n\n```js\ncoverage({\n  include: ['src/**'],\n  reporter: ['text', 'html', 'lcov'],\n});\n```\n\n### Enforce coverage thresholds\n\nSet a single threshold for all metrics at once by passing a `number`:\n\n```js\ncoverage({\n  include: ['src/**'],\n  checkCoverage: 100,\n});\n```\n\nOr use `true` to set individual thresholds for each metric:\n\n```js\ncoverage({\n  include: ['src/**'],\n  checkCoverage: true,\n  lines: 95,\n  branches: 90,\n  functions: 85,\n  statements: 95,\n});\n```\n\n### TypeScript coverage\n\n```js\ncoverage({\n  include: ['src/**'],\n  extension: ['.ts'],\n  all: true,\n});\n```\n\n### Require `--coverage` flag\n\nBy default, coverage runs whenever the plugin is active. Use `requireFlag` to only collect coverage when `--coverage` is passed to the CLI, keeping watch mode, debugging, and filtered runs fast:\n\n```js\ncoverage({\n  include: ['src/**'],\n  requireFlag: true,\n});\n```\n\n```bash\n# No coverage (plugin is a no-op)\npoku test/\n\n# With coverage\npoku --coverage test/\n```\n\n### Using a config file\n\nReuse your existing `.c8rc`, `.nycrc`, or any JSON/JSONC config file with comments:\n\n```jsonc\n// .c8rc\n{\n  // Only cover source files\n  \"include\": [\"src/**\"],\n  \"reporter\": [\"text\", \"lcov\"],\n  \"check-coverage\": true,\n  \"lines\": 90,\n}\n```\n\n```js\ncoverage({\n  config: '.c8rc', // or false to disable auto-discovery\n});\n```\n\nWhen no `config` is specified, the plugin automatically searches for `.c8rc`, `.c8rc.json`, `.c8rc.jsonc`, `.nycrc`, `.nycrc.json`, or `.nycrc.jsonc` in the working directory.\n\nYou can also specify the config path via CLI:\n\n```bash\npoku --coverageConfig=.c8rc test/\n```\n\n\u003e [!NOTE]\n\u003e\n\u003e **Priority order:**\n\u003e\n\u003e - For config file discovery: `--coverageConfig` (CLI) \u003e `config` (plugin option) \u003e auto-discovery\n\u003e - For coverage options: plugin options \u003e config file options\n\n### Extending Monocart reporters\n\n```bash\nnpm i -D monocart-coverage-reports\n```\n\n```js\ncoverage({\n  include: ['src/**'],\n  reporter: ['v8', 'console-details', 'codecov'],\n  experimental: ['monocart'],\n});\n```\n\n---\n\n## How It Works\n\n- **`setup`** creates a temp directory and sets `NODE_V8_COVERAGE` — every test process spawned by **Poku** automatically writes **V8** coverage data\n- **`teardown`** uses **c8** to generate reports from the collected data, optionally checks thresholds, then cleans up\n- No modification to test commands or runner configuration needed\n\n---\n\n## License\n\n**MIT** © [**wellwelwel**](https://github.com/wellwelwel) and [**contributors**](https://github.com/pokujs/c8/graphs/contributors).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpokujs%2Fc8","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpokujs%2Fc8","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpokujs%2Fc8/lists"}