TypeScript Coverage

This documentation was generated with the assistance of AI. Please report any inaccuracies.

Run the project’s TypeScript/JavaScript test runner — Vitest, Jest, or Angular’s ng test — with coverage enabled, then read the exact percentages from the generated coverage/coverage-summary.json (falling back to coverage/lcov.info when the summary is missing or a specific file isn’t in it). This is a read-only reporting skill: it measures and reports coverage, it does not add tests or modify source/test code unless asked to as an explicit follow-up. It also recognizes NestJS, Next.js and React Native projects, adjusting which suite is measured and which files are excluded.

Purpose

iru-typescript-coverage answers "does file X meet the coverage bar?" with an exact, report-derived percentage instead of an eyeballed guess from a runner’s console output. It reuses iru-typescript-test’s selector syntax to scope which tests run, infers or accepts explicit target files, and — for files under the bar — points to the exact uncovered line ranges (collapsed from consecutive `DA:<line>,0 records in lcov.info) so a follow-up can target them precisely.

Framework awareness (detected from package.json, on top of the runner detection):

  • NestJS (@nestjs/core) — measures the unit suite only (the default Vitest or Jest config, never the e2e config, which boots the app and often needs Docker), excludes pure wiring files (*.module.ts, src/main.ts) and generated code inside src/ (for example a Prisma client) unless the project’s own coverage config includes them, and says so in the report.

  • Next.js (next) — measures Vitest (v8 provider) or Jest (via next/jest) coverage only; Playwright end-to-end tests are never run or counted. Include globs target the app’s own source, and a Server Component that cannot be rendered in a unit test is reported as "only reachable through e2e" rather than as an untested file.

  • React Native (react-native or expo; toolchain expo when expo is a dependency, otherwise metro) — always Jest’s built-in coverage (jest-expo, @react-native/jest-preset or the legacy react-native preset). Because neither scaffold sets collectCoverageFrom, every run adds exclusions after the include glob: android/, ios/, .expo/, coverage/, e2e/, .d.ts, .config., .*rc., the root index.{js,ts} registration entry, test files and Codegen Native*.ts specs, and says so in the report. Maestro/Detox device e2e is never run or counted; a screen reachable only through a device flow is reported as "only reachable through device e2e".

Plugin

Shipped by the iru-typescript plugin of the ai-catalog marketplace (install with /plugin install iru-typescript@ai-catalog; see Plugins).

Invocation

/iru-typescript-coverage
/iru-typescript-coverage [scope]

Inputs

Argument Required Description Default

scope

No

A file path, a directory, or a name pattern — the same selector syntax as the iru-typescript-test skill’s. Must cover every test that exercises the target file(s) — a selector scoped too narrowly undercounts real coverage, so a broader selector (a directory, or the full suite) is preferred when in doubt.

None — omitting it runs the whole suite and reports whole-project coverage.

Outputs

  • A plain-text summary in the conversation — never a written file.

  • Per target file: exact line and branch coverage percentages (and functions, when relevant), computed directly from coverage/coverage-summary.json (or coverage/<project-name>/coverage-summary.json for Angular CLI) — never estimated.

  • If the user gave a coverage bar (e.g. "at least 80%"): a clear statement of whether each file/the total meets it.

  • For files under the bar: uncovered line ranges collapsed from lcov.info’s `DA: records (e.g. src/math.ts: lines 66.66% — uncovered: 11, 17).

  • For NestJS, Next.js and React Native, a note of which wiring files, native trees, config files or generated code were excluded and which suites were deliberately not measured (e2e, Playwright, Maestro/Detox).

  • "Coverage not wired" (naming the missing package/config, e.g. @vitest/coverage-v8) instead of a false 0%/100% when the coverage provider isn’t installed.

  • A file that has zero tests is forced into the report at 0% (via the runner’s include flag), not silently omitted.

  • No source or test code is ever modified, and coverage is never re-run to try to raise a number.

Execution flow

flowchart TD A["Start /iru-typescript-coverage\n(optional scope)"] --> B["Detect runner (Vitest, Jest,\nAngular ng test) and package manager,\nsame as iru-typescript-test"] B --> B2["Detect framework: NestJS, Next.js or React Native\n(unit suite only, exclude wiring/native/config files)"] B2 --> C{Scope given?} C -- yes --> D["Scope tests using\ntypescript-test's selector syntax"] C -- no --> E["Run whole suite,\nwhole-project coverage"] D --> F E --> F["Determine target file(s):\nexplicit list, or inferred from\nselector, or every file the report lists"] F --> G["Confirm coverage provider installed\n(@vitest/coverage-v8, coverage-istanbul, etc.)"] G --> H{Provider installed?} H -- no --> I["Report 'coverage not wired'\nnaming the missing package"] H -- yes --> J["Run coverage command with lcov +\njson-summary reporters and include flag\nfor untested files"] J --> K{Run succeeded?} K -- no --> L["Report failure, stop\n(don't read a stale report)"] K -- yes --> M["Read coverage-summary.json\n(fallback: lcov.info LF/LH/BRF/BRH)"] M --> N["Compute line / branch / function\ncoverage % per target file"] N --> O{File found in report?} O -- no --> P["Report glob didn't match\n(not a false 0%)"] O -- yes --> Q["Report exact %; state pass/fail\nvs. any given bar"] Q --> R{Under the bar?} R -- yes --> S["Collapse lcov.info DA: records\ninto uncovered line ranges"] R -- no --> T["State it meets the bar"]

Dependencies

Invokes

None — iru-typescript-coverage is a leaf skill; it only runs the project’s test runner and reads the generated coverage reports, it does not call any other skill in this catalog.

Invoked by

  • iru-gate-runner — both iru-typescript-code-one-task-group and iru-typescript-generate-all-tests always invoke this skill from inside a iru-gate-runner sub-agent they spawn, not inline.

Source

SKILL.md on GitHub — the file this page was generated from.