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 🙏

© 2025 – Pkg Stats / Ryan Hefner

capuccino

v0.6.6

Published

simple esm test runner

Downloads

67

Readme

What is this?

A test runner, inspired by jest, mocha and chai.

Why another test runner?

I was fed up with trying to get any of the above to run with ESM.

Goals

Provide a test-runner with api similar to the aforementioned test-runners but with out of the box support for esm and with a touch of functional programming.

Non-Goals

Be a drop-in substitute for jest, mocha or chai. While this project is inspired by those widely-used test-runners my goal is not to provide exactly the same api.

What makes it different from mocha and the likes?

Every test is async by default which enables the same spec to be run in node or in the browser or even with a browser interface for nodejs tests. So you can even re-run your tests on the backend without --inspect-brk and the likes.

It also does not provide much in the way of expect.it.to.be.the.same as I found this way of writing tests - while very expressive - not very useful. As soon as you have more complicated datastructures it falls short anyway.
Instead it's possible to combine assertions and thus build your own custom assert functions rather easily.

Example

// test/some.spec.ts
import {describe, it, assert, either, and, fail, success} from "capuccino";

describe("feature x", () => {
  // basic usage
  it("should work", async () => {
    return assert(true, "expected this to work");
  })

  // handling exceptions
  it("should prove the collatz conjecture", async () => {
    try {
      prove3nPlus1();
      return success;
    } catch(e) {
      return fail(e.message);
    }
  })

  // combine assertions
  it("should either provide a single number or a tuple with a string and a number", async (done) => {
    const result = someFunction();
    const tuple = !Array.isArray(result) || result.length !== 2 ? undefined : result;
    either(
      assert(typeof result === "number", "expected a number"),
      and(
        assert(tuple != null, "expected a tuple")
        assert(typeof tuple[0] === "string", "expected first element of tuple to be a string"),
        assert(typeof tuple[1] === "number", "expected second element of tuple to be a number")
      )
    )
  })
})
npx capuccino test/**.spec.js

or just start the whole thing as a server. Doesn't support hot reloading because it just re-bundles all globbed files + dependencies on reload. Should be fast enough, thanks to esbuild.

npx capuccino --browser test/**.spec.js

and if your code depends on other code that's outside of the current directory (i.e. monorepo) and you would like to debug that code as well you can set the working directory like

npx capuccino --working-dir ../.. test/**.spec.ts

Typescript

Sadly I had to move away from typescript for now as I could not figure out how to integrate ts-node without additional setup from your side. This means that you should also build your test files, ideally with the same config.

I am still working on rectifying this.

Sourcemaps

If you want sourcemaps I recommend setting --inlineSourceMap and --inlineSources in some sort of "dev-script". Yes, it greatly increases the size of the generated output, but any bundler should drop those anyway if configured to do so. Depending on whether you want to deliver the transpiled code you could even make this permanent by writing it to your tsconfig.json.