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

@triadjs/test-runner

v0.2.2

Published

In-process BDD test runner with schema-derived adversarial test generation

Readme

@triadjs/test-runner

In-process BDD test runner for Triad routers with schema-derived adversarial test generation.

Install

npm install @triadjs/test-runner

Quick Start

Standalone runner

import { runBehaviors } from '@triadjs/test-runner';
import router from '../src/app.js';

const summary = await runBehaviors(router, {
  servicesFactory: () => createTestServices(),
  teardown: (services) => services.cleanup(),
});

console.log(`${summary.passed}/${summary.total} passed`);

Vitest / Jest integration

import { describe, it } from 'vitest';
import { registerBehaviors } from '@triadjs/test-runner';
import router from '../src/app.js';

registerBehaviors(router, {
  describe,
  it,
  servicesFactory: () => createTestServices(),
  teardown: (services) => services.cleanup(),
});

Each endpoint becomes a describe block and each behavior becomes an it, so test reporters show scenario names as business rules.

Features

  • Per-scenario isolation -- servicesFactory is called before every scenario and teardown runs in a finally block, giving each test a clean slate.
  • Placeholder substitution -- {placeholder} tokens in body, params, query, and headers are replaced with values from given.fixtures and the return value of given.setup().
  • Response validation -- handler responses are validated against the declared response schema for their status code, catching handlers that sidestep ctx.respond.
  • Custom matchers -- pass a CustomMatcher map to extend the assertion engine beyond the built-in checks.

Channel Testing

Test WebSocket channels with runChannelBehaviors:

import { runChannelBehaviors } from '@triadjs/test-runner';

const summary = await runChannelBehaviors(router, {
  servicesFactory: () => createTestServices(),
});

The channel runner follows the same per-scenario isolation pipeline as the HTTP runner -- fresh services, fixture substitution, teardown -- but drives a ChannelHarness that simulates WebSocket connections and message exchanges in-process.

scenario.auto()

Schema-derived adversarial test generation. Add scenario.auto() to any endpoint and the runner reads its request schema at execution time to generate test cases automatically:

  • Missing fields -- omits each required field one at a time
  • Boundary values -- tests min/max lengths, numeric limits, and edge values
  • Type confusion -- sends wrong types (string where number expected, etc.)
  • Invalid enums -- sends values outside declared enum sets
  • Random fuzzing -- generates N random valid payloads (configurable via randomValid)

All generated scenarios expect a 400 response, validating that the router rejects malformed input.

CLI

# Run all behavior tests
npx triad test

# Run schema-derived fuzz tests
npx triad fuzz

Links