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

fuzzbuzz

v2.0.0

Published

Fuzz testing framework

Readme

fuzzbuzz

Fuzz testing framework

npm install fuzzbuzz

Usage

const FuzzBuzz = require('fuzzbuzz')

const fuzz = new FuzzBuzz({
  async setup () {
    console.log('do some initial setup')
    await sleep(100)
  },
  async validate () {
    console.log('validate your state')
    await sleep(100)
  }
})

// print out the random seed so things can be reproduced
console.log('random seed is', fuzz.seed)

// add an operation
fuzz.add(1, async function () {
  console.log('hi')
  await sleep(100)
})

// add another one that should be called ~10 times more
fuzz.add(10, async function () {
  console.log('ho')
  await sleep(100)
})

// run 20 operations
fuzz.run(20)

function sleep (n) {
  return new Promise(resolve => setTimeout(resolve, n))
}

API

fuzz = new FuzzBuzz([options])

Make a new fuzz tester. Options include:

{
  seed: ..., // pass in a random seed here (32 byte buffer or hex string)
  async setup(), // pass in a section function that is run before operations
  async validate() // pass in validator that is run after all operations are done
}

fuzz.add(weight, async fn)

Add a testing operation. weight should be a positive integer indicating the ratio you wanna call this operation compared to other ones.

fn should be a function that does some testing function. Internally it is awaited so it is same to make this an async function. If you are testing a callback API accept a callback in the fn signature like so fn(callback).

fuzz.remove(weight, fn)

Remove an operation again.

promise = fuzz.run(times)

Run the fuzzer. First runs the setup function, then runs times operations where each operation is picked randomly based on their relative weight. After the operations are done, the validate function is run.

The randomness that is used to pick each operation is based on the seed from the constructor so if you pass the same seed twice the order is deterministic.

promise<minRuns> = fuzz.bisect(maxTimes)

Using a bisection algorithm the fuzzer will find the minimum amount of runs for either your validation function to fail or for an operation to throw.

The returned minimum amount of runs are returned afterwards.

item = fuzz.pick(array)

Pick a random element from an array. Uses the random seed as well.

num = fuzz.random()

Roll a random number between 0 and 1. Uses the random seed as well.

integer = fuzz.randomInt(max)

Helper to roll a random integer.

promise = fuzz.call(operations)

Call a random function from an array of weighted functions. Uses the random seed as well.

The operations array should be an array of [ weight, async fn ] pairs.

fuzz.setup(async fn)

Set the setup function after constructing the fuzzer.

fuzz.validate(async fn)

Set the validate function after constructing the fuzzer.

fuzz.debug(msg)

Print out a debug message. Requires options.debugging = true or the DEBUG env var to contain fuzzbuzz to print it out.

License

MIT