npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

testkit-cli

v1.0.0

Published

<p align="center"> <img src=".github/assets/banner.svg" alt="testkit-cli banner" width="800"/> </p>

Downloads

17

Readme

testkit-cli

Test coverage analysis, quality detection, and test generation CLI — find untested code, detect anti-patterns, and generate tests from your terminal.

No MCP. No external APIs. Pure filesystem analysis with regex-based code parsing.

Install

npm install -g testkit-cli
# or run without installing:
npx testkit-cli coverage .

Architecture

graph LR
  A[terminal] --> B[testkit CLI]
  B --> C[analysis engine]
  C --> D[coverage-parser]
  C --> E[ast-analyzer]
  C --> F[config-validator]
  C --> G[project-scanner]
  D --> H[results]
  E --> H
  F --> H
  G --> H
  H --> I[formatters]
  I --> J[human-readable output]
  H --> K[--json flag]
  K --> L[JSON output]

Commands

testkit coverage [path]

Analyze test coverage for a project.

testkit coverage .
testkit coverage ./my-project --threshold 90
testkit coverage . --coverage-path ./coverage/lcov.json --json

Options:

  • --coverage-path <path> — explicit path to coverage JSON (auto-detected if omitted)
  • --threshold <n> — minimum coverage % (default: 80)
  • --json — JSON output

Exit codes: 0 = success, 1 = error, 2 = coverage below threshold (for CI)

Example output:

Coverage Report — my-project
────────────────────────────────────────────────────────────
File                                Lines  Branch     Fn
src/utils.ts                          92%     85%    100%
src/api.ts                            45%     30%     50%  ← below threshold

Overall: 78% lines | 72% branches | 83% functions
Files below 80% threshold: 1 of 2

testkit missing [path]

Find source files with missing tests.

testkit missing .
testkit missing . --include "src/**/*.ts" --json

Options:

  • --include <patterns...> — glob patterns for source files
  • --exclude <patterns...> — glob patterns to exclude
  • --json — JSON output

testkit quality [path]

Analyze test quality and detect anti-patterns.

testkit quality .
testkit quality . --min-score 80

Options:

  • --min-score <n> — minimum quality score (exit 2 if below)
  • --json — JSON output

Detected patterns: assertion-free, snapshot-heavy, implementation-coupled, hardcoded-timeout, no-error-tests, console-pollution, broad-mock

testkit config [path]

Validate test configuration and detect issues.

testkit config .
testkit config . --json

Options:

  • --json — JSON output

testkit generate unit <file>

Generate unit test scaffolds for a source file.

testkit generate unit src/utils.ts
testkit generate unit src/api.ts --framework jest --output tests/api.test.ts
testkit generate unit src/utils.ts --json

Options:

  • --framework <vitest|jest> — test framework (auto-detected or defaults to vitest)
  • --output <path> — write to file instead of stdout
  • --json — JSON output

testkit generate integration <file>

Generate integration test scaffolds for a route file.

testkit generate integration src/routes/users.ts
testkit generate integration src/routes/auth.ts --output tests/auth.integration.test.ts

Options:

  • --framework <vitest|jest> — test framework
  • --output <path> — write to file instead of stdout
  • --json — JSON output

testkit generate e2e <description>

Generate E2E test scaffold from a flow description.

testkit generate e2e "user logs in and views dashboard"
testkit generate e2e "checkout flow" --framework cypress --output cypress/e2e/checkout.cy.ts

Options:

  • --framework <playwright|cypress> — E2E framework (default: playwright)
  • --output <path> — write to file instead of stdout
  • --json — JSON output

Global Options

| Option | Description | |:-------|:-----------| | --json | Output as JSON instead of human-readable | | -V, --version | Print version | | -h, --help | Print help |

CI Integration

# GitHub Actions
- name: Check coverage
  run: npx testkit-cli coverage . --threshold 80
  # exits 2 if below threshold, 1 on error

- name: Check test quality
  run: npx testkit-cli quality . --min-score 70

Exit Codes

| Code | Meaning | |:-----|:--------| | 0 | Success | | 1 | Error (invalid input, file not found) | | 2 | Threshold/score check failed (for CI) |

Pro Features

Set PRO_LICENSE environment variable to unlock:

testkit mutate <file> (PRO)

Run mutation testing to assess test effectiveness.

PRO_LICENSE=your-key testkit mutate src/utils.ts
PRO_LICENSE=your-key testkit mutate src/api.ts --test-command "npx jest" --timeout 60000

Options: --test-command <cmd>, --timeout <ms>, --json

testkit flaky [path] (PRO)

Detect flaky test indicators via static analysis (timing, network, shared state, async race, order dependency).

PRO_LICENSE=your-key testkit flaky .

testkit impact <files...> (PRO)

Analyze which tests are affected by changed source files (BFS import graph).

PRO_LICENSE=your-key testkit impact src/utils.ts src/api.ts

testkit snapshots [path] (PRO)

Audit snapshot tests for issues (oversized, implementation-detail, missing companion assertions).

PRO_LICENSE=your-key testkit snapshots .

testkit mocks [path] (PRO)

Analyze mock patterns in test files (over-mocked, broad-mock, signature-mismatch).

PRO_LICENSE=your-key testkit mocks .

testkit report [path] (PRO)

Generate a comprehensive test health report combining coverage, missing, quality, and config analysis.

PRO_LICENSE=your-key testkit report .
PRO_LICENSE=your-key testkit report . --format markdown --output report.md

Options: --format <json|markdown>, --output <file>, --json

Get a license at craftpipe.dev/testkit-cli.

Supported Frameworks

  • vitest (auto-detected from vitest.config.*)
  • jest (auto-detected from jest.config.* or package.json#jest)
  • mocha (auto-detected from .mocharc.*)

License

MIT — see LICENSE

Built by Craftpipe