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

@luckystack/test-runner

v0.2.5

Published

Generated-type-driven test layers for LuckyStack: contract smoke (Zod-valid input), auth enforcement, rate-limit, and crash-resistance fuzz. Walks every endpoint via the generated apiMethodMap.

Readme

@luckystack/test-runner

Generated-type-driven test layers for LuckyStack. Walks every endpoint in your apiMethodMap.generated.ts and runs four progressive test layers: contract smoke (Zod-valid input), auth enforcement, rate-limit, and crash-resistance fuzz.

Install

npm install --save-dev @luckystack/test-runner zod

Quickstart

Run all four layers against a running server:

import {
  runContractTests,
  runAuthEnforcementTests,
  runRateLimitTests,
  runFuzzTests,
  resetServerState,
  logContractSummary,
} from '@luckystack/test-runner';
import { apiMethodMap } from './src/_sockets/apiMethodMap.generated';
import { apiMetaMap } from './src/_sockets/apiMetaMap.generated';

const baseUrl = process.env.TEST_BASE_URL ?? 'http://127.0.0.1:80';
const contract = await runContractTests({ apiMethodMap, baseUrl });
logContractSummary(contract);

const auth = await runAuthEnforcementTests({ apiMethodMap, apiMetaMap, baseUrl });
const rate = await runRateLimitTests({ apiMethodMap, apiMetaMap, baseUrl });
const fuzz = await runFuzzTests({ apiMethodMap, baseUrl });

await resetServerState({ baseUrl });

Each layer is independently runnable — you can skip the ones that don't apply or rearrange them.

Layers

| Layer | What it asserts | | --- | --- | | Contract | A Zod-valid input payload reaches main and returns { status: 'success' } (or a typed failure status). Catches schema/route mismatches. | | Auth enforcement | Endpoints flagged auth.login: true reject unauthenticated requests with the framework's standard 401 shape. | | Rate limit | Endpoints with rateLimit: <N> reject the (N + 1)th request inside the window. | | Fuzz | Bad/random inputs never crash the server (still returns a typed error response, never 500 with a stack). |

The fuzz layer is intentionally exhaustive and slow — wire it into nightly CI rather than every PR.

Server hooks it depends on

  • /_test/reset endpoint — served by @luckystack/server outside production (gated on NODE_ENV !== 'production' and an optional TEST_RESET_TOKEN). Used by resetServerState to clear DB + Redis between layers. Make sure TEST_RESET_TOKEN is set in any non-prod environment that is reachable over the network.
  • apiMethodMap.generated.ts — produced by @luckystack/devkit from your _api/* files. Defaults are read via getApiMethodMapPath() from @luckystack/core.

Public API

| Export | Purpose | | --- | --- | | walkEndpoints(apiMethodMap) | Returns EndpointDescriptor[] from the generated map. | | runContractCheck(input) / runContractTests(input) | Single endpoint / full sweep. | | runAuthEnforcementCheck(input) / runAuthEnforcementTests(input) | Auth layer. | | runRateLimitCheck(input) / runRateLimitTests(input) | Rate-limit layer. | | runFuzzCheck(input) / runFuzzTests(input) | Fuzz layer. | | resetServerState(input) | POST to /_test/reset. | | sampleSchemaInput(schema) | Generate a Zod-valid sample payload. | | logContractResult / logContractSummary | Pretty-printers. |

Types: EndpointDescriptor, HttpMethod, ContractCheckResult, RunContractSummary, plus per-layer input types.

Related architecture docs

Dependencies

  • Peer (canonical ranges, standardized 2026-05-07):
    • zod@^3.25.0

License

MIT — see LICENSE.