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

borzoi-test

v0.1.3

Published

JavaScript ES6 testing library.

Readme

(Photo credit)

Borzoi Test

Typescript and JavaScript ES6 testing library.

Table Of Contents

Overview

Borzoi test implements a simple familiar testing pattern, compatible with Typescript.

Named after Borzoi dogs because their long noses will sniff out any bugs in your code :)

Makes it easy to define tests as a simple script file and run this file like you would any other NodeJs script. No fancy command line test runners required. Just make a script which uses Borzoi Test and run it with node tests.js.

To use:

npm install --save-dev borzoi-test

Then make a NodeJs script file and require Tester (default export) and RuntimeTester(named export, you only need to import this if you are using Typescript):

import Tester, { RuntimeTester } from "borzoi-test";

Next create an instance of a Tester. The constructor takes a subject and test function as arguments:

const tests = new Tester("A short blurb about what I am testing", (T: RuntimeTester) => {
    // ...
});

The second argument, the test function, defines the test logic itself. This function is provided a RuntimeTester instance as an argument. With this you can define assertions or sub-tests.

const tests = new Tester("A short blurb about what I am testing", (T: RuntimeTester) => {
    // Define assertions
    T.assert("A short description of what is being asserted")
        .actual(["a", "b", "c"].join("-"))
        .eq("a-b-c"); // Can use: ne(), lt(), gt(), lte(), gte() as well
        
    // Define sub-tests
    T.test("Another short blurb, a sub-test", (T: RuntimeTester) => {
        // ... Do sub-tests here ....
    });
});

Assertions are defined in a fluid style, calling T.assert() returns an Assertion instance. The Assertion class defines the actual() method which allows you to provide the value being tested by the assertion. Additionally the eq() (equal), ne() (not equal), lt() (less than), gt() (greater than), lte() (less than or equal), and gte() (greater than or equal) methods let you provide the expected value and decide how the actual and expected values are compared.

The RuntimeTester test() method works exactly the same as the Tester constructor. The first argument is a subject description and the second argument is the test function. However tests defined this way are recorded as sub-tests. This is purely for code organization purposes and does not effect the way tests are run. Sub-tests can be nested as many levels deep as you want.

Finally you must run the execute() method of the Tester instance you created at the beginning.

const tests = new Tester("A short blurb about what I am testing", (T: RuntimeTester) => {
    // ...
});

tests.execute();

This execute() method of the Tester class will run all the defined tests and exit the process with code 0 if all tests succeeded and 1 if any tests failed. Additionally a color coded summary of test results is printed to standard output. For your benefit this output also visually indicates sub-tests by indenting them under their parent test.

Then all you have to do is make your NPM test script run the file you just wrote. Simple as that.

{
    "...": "...",
    "scripts": {
        "test": "node location/of/your/test.js"
    },
    "...": "..."
}

The complete example:

import Tester, { RuntimeTester } from "borzoi-test";

const tests = new Tester("A short blurb about what I am testing", (T: RuntimeTester) => {
    // Define assertions
    T.assert("A short description of what is being asserted")
        .actual(["a", "b", "c"].join("-"))
        .eq("a-b-c"); // Can use: ne(), lt(), gt(), lte(), gte() as well
        
    // Define sub-tests
    T.test("Another short blurb, a sub-test", (T: RuntimeTester) => {
        // ... Do sub-tests here ....
    });
});

tests.execute();

Note that you don't need to import RuntimeTester nor have any type annotations if you are not using Typescript.

Development

Written in Typescript and compiled into JavaScript.

To develop first install dependencies:

npm install

Then compile the Typescript to JavaScript:

npm run build

This outputs the results to lib/. The main file is lib/index.js. Typescript type definitions are outputted to lib/index.d.ts.

Next test the code:

npm run test

To publish a new NPM package version:

npm publish