TypeScript Generate All Tests

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

Bring an entire TypeScript codebase’s unit test coverage up to a minimum bar — 80% line coverage — in one pass: find every source file with no test at all or with measured coverage below the bar, then write or extend tests for each until it clears it. TypeScript/npm only; it never runs against, or falls back to, any other language.

Purpose

iru-typescript-generate-all-tests answers "bring this whole codebase’s test coverage up to a bar" rather than "write tests for this one file/task," which is what iru-typescript-code-one-task and the iru-code pipeline already handle per task. It explores the whole codebase to build an inventory of testable files across any detected flavor (library, React, Angular, React Native, Ionic, or Hilla frontend), delegates to iru-typescript-coverage for the exact, measured percentage per file, and only writes or extends test code — it does not add license headers, TSDoc, or run a code-quality pass, and it only touches production source code when a file is genuinely untestable as written (e.g. no seam to substitute a hard dependency), which it reports explicitly rather than silently redesigning the module.

For React Native it also resolves the toolchain (expo in dependencies is expo, otherwise metro), the Jest preset (jest-expo, @react-native/jest-preset or the legacy react-native preset) and the installed @testing-library/react-native major, excludes the same native/config/entry files as iru-typescript-coverage so both agree on the candidate set, and hands each test-writing agent a set of React Native rules: awaited render/fireEvent on RNTL 14, Expo Router’s renderRouter for Expo screens, library Jest mocks for metro’s third-party native modules, native code mocked at its JS boundary, fake timers for animations, and a stop-and-ask on transformIgnorePatterns failures.

For a web UI project with Playwright wired (React/Vite, Angular, Ionic, Next.js, Hilla) a further step (Step 6b) generates UI tests per the catalog’s UI contract (see Building user interfaces) for every existing screen and component that has none: one story per visual state, Playwright component specs through the project’s component gallery, and screen specs against the built app, each capturing the .ui-quality.yml directions (states x left-to-right/right-to-left x light/dark) into .ui-screenshots/ with an accessibility check. It creates the shared support/ui-screenshots.ts helper when missing, asks before adding @axe-core/playwright, and never scaffolds Playwright itself (no Playwright means "UI tests not generated"); React Native UI tests are left to iru-react-native-code-one-task. Accessibility violations it finds are reported, not silently fixed.

When .ui-quality.yml says accessibility: none (opted out entirely) or off (rules apply, checks not run), accessibility checks are not applicable: they are skipped and reported as "accessibility: opted out" (none) or "accessibility checks off" (off) — never "unverified" and never a failure.

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-generate-all-tests

Inputs

None — no arguments are accepted. It always scopes to the whole repository (or, in a workspaces/monorepo setup with no obvious single target, asks which workspace to scope the run to before continuing).

Outputs

  • New or extended test files for every source file found with no matching test file, or with line coverage below 80% — following this project’s detected flavor’s testing library (Vitest/Jest, @testing-library/react, @testing-library/react-native (under jest-expo or @react-native/jest-preset), Angular TestBed, or Hilla Vitest browser mode) and its existing test-file convention (sibling .test/.spec, or a mirrored test/ tree).

  • Occasionally, a minimal testability change to a module under test (e.g. accepting a dependency as a parameter, extracting a hook/service) — only when a file is genuinely untestable as written, and always called out explicitly rather than folded silently into "tests added."

  • For React Native, no silent dependency changes: when @testing-library/react-native isn’t installed (the CLI template only ships react-test-renderer) it asks via AskUserQuestion whether to add it, and otherwise follows the existing react-test-renderer style, noting that it is deprecated for React 19; a transformIgnorePatterns change is reported and asked about, never edited.

  • A report: total candidate files found (and any excluded as having no testable logic), the detected flavor/test runner/package manager/test-file convention, how many already met the bar, before/after coverage per file touched, any file still below 80% after two extension attempts (with its exact remaining uncovered lines), and the full-suite test result.

  • For web UI projects: story files and Playwright component/screen specs for every uncovered screen and component, the support/ui-screenshots.ts helper when absent, and screenshots under .ui-screenshots/<kind>/<Id>/; the report adds screens/components found and covered, states covered, screenshot count, accessibility violations (rule ids) at the .ui-quality.yml level, and anything left without UI tests or "unverified".

  • No license headers, TSDoc, or code-quality fixes — those remain iru-check-license, iru-typescript-tsdoc, and `iru-typescript-code-quality’s jobs.

Execution flow

flowchart TD A[Start /iru-typescript-generate-all-tests] --> B{"package.json found?"} B -- no --> B1[Stop: TypeScript/npm only] B -- yes --> C{"TypeScript toolchain\npresent?"} C -- no --> C1[Stop: this skill is for\nTypeScript projects] C -- yes --> D{"Multiple package.json,\nno obvious target?"} D -- yes --> D1[AskUserQuestion: which\nworkspace to scope to] D1 --> E D -- no --> E["Explore agent: inventory source\nfiles, detect flavor (React Native: toolchain,\npreset, RNTL major), test runner,\npackage manager, test convention;\nexclude native/config/entry files"] E --> F{"No tests exist and no\ntest runner configured?"} F -- yes --> F1[Stop: ask user; this skill\nextends tests, doesn't scaffold one] F -- no --> G["gate-runner: single\ntypescript-coverage run over every\ncandidate file (batched if large)"] G --> H["Classify: missing tests /\nbelow 80% / already sufficient"] H --> I["One agent per file (parallel\nbatches): write new or extend\nexisting tests\n(React Native rules for RN projects)"] I --> J["Re-measure via\ntypescript-coverage, scoped to\ntouched files"] J --> K{"Still below 80%?"} K -- yes, attempts left --> I K -- yes, 2 attempts used --> L[Report as residual gap\nwith exact uncovered lines] K -- no --> M["gate-runner: run full\nsuite once (typescript-test)"] L --> L2["Web UI project with Playwright:\ngenerate stories and UI specs\nper gap, run via typescript-test ui"] L2 --> M["gate-runner: run full\nsuite once (typescript-test)"] M --> N{"Any failures?"} N -- yes, caused by this run --> O[Fix regression;\nre-run full suite] O --> M N -- no / pre-existing --> P[Final report]

Dependencies

Invokes

  • TypeScript Coverage — Step 3, and again in Step 6 to re-measure after generation: delegated through the iru-gate-runner agent so its full lcov.info/coverage HTML report never lands directly in this conversation, and so the whole suite runs once per batch rather than once per file.

  • TypeScript Test — Step 6b (the ui selector, to run the generated UI specs once) and Step 7, once, to confirm the full suite still passes after every file’s tests have been written or extended; also delegated through iru-gate-runner.

Invoked by

None from inside this catalog — it is a top-level entry point invoked by a person who wants coverage brought up across the whole codebase in one pass, independent of the /iru-code//iru-issue pipeline (which handles per-task test-writing via iru-typescript-code-one-task).

  • Explore — Step 2, to build the source-file/test-file inventory and detect the project’s flavor, test runner, package manager, and test convention without reading every file directly.

  • iru-gate-runner — Steps 3, 6, 6b, and 7, to run iru-typescript-coverage/ iru-typescript-test and report back only a compact summary instead of a raw coverage/test log.

  • general-purpose (default, no subagent_type named) — Step 5, one per file needing new/extended tests, dispatched concurrently since each only touches its own test file (Step 6b dispatches one per component/screen for UI tests the same way).

Source

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