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

@ferrow/fixture-factory

v1.0.0

Published

Seeded, deterministic test fixture builder: sequences, pick, factory refs, traits, and afterBuild hooks. Zero runtime dependencies.

Readme

fixture-factory

CI

Seeded, deterministic test fixture builder: sequences, pick, factory refs, composable traits, and afterBuild hooks. Strict TypeScript, zero runtime dependencies.

Why

Flaky fixtures make flaky tests. This factory library is deterministic by construction — a mulberry32 PRNG seeded at define() time means the same seed and template always produce the same fixture sequence, so failures are reproducible and snapshot tests stay stable.

Quickstart

import { define, sequence, pick, ref } from "fixture-factory";

const userFactory = define(
  "user",
  {
    id: sequence((i) => `user-${i}`),
    name: pick(["Alice", "Bob", "Cara"]),
    role: "member",
  },
  { seed: 42 }
).trait("admin", { role: "admin" });

const postFactory = define("post", {
  id: sequence((i) => `post-${i}`),
  author: ref(userFactory),
  published: false,
}).trait("published", { published: true });

const post = postFactory.build(undefined, { traits: ["published"] });
const admin = userFactory.build(undefined, { traits: ["admin"] });

API

define(name, template, options?): Factory

options.seed (default 0) seeds the factory's internal PRNG.

Template values

  • Literals — used as-is.
  • sequence(fn)fn(index), where index is a 1-based counter incremented once per build().
  • pick(values) — seeded-random selection from values.
  • ref(factory, overrides?, maxDepth?) — builds a related fixture via another factory. Ref chains deeper than maxDepth (default 3) resolve to null instead of recursing forever.
  • Functions — (ctx) => value, given { rng, sequenceIndex, depth } for custom logic.

Factory.trait(name, partialTemplate)

Registers a named partial template. Composable — pass multiple trait names to build/buildList and they apply in order, each overriding the fields it specifies.

Factory.afterBuild(hook)

Runs hook(built, ctx) after every build; return a value to replace the fixture, or mutate and return undefined.

Factory.build(overrides?, options?) / Factory.buildList(n, overrides?, options?)

options.traits selects which registered traits to apply.

Limits

  • Determinism holds only across separately-defined factories with the same seed and the same sequence of build calls — reordering or adding extra build() calls between two runs will desync their PRNG/sequence state.
  • ref() depth limiting returns null past the limit rather than throwing — check for null in your templates if a ref chain could realistically be circular.
  • No async factories — build functions run synchronously.

Part of the ferrow-toolkit collection · Sponsored by Ferrow