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

testsome

v1.0.3

Published

A minimal test runner.

Downloads

13

Readme

testsome

testsome is a small JavaScript test runner without any dependencies.

Usage

To run a test with testsome, a test function is provided. It takes the test's name and a function which will be called:

function test(name: string, func: (t: T) => void): void

The passed function func gets a parameter of type T which can be used to manage test state:

interface T {
    skip(): void;
    fail(): void;
    error(msg?: string): void;
    fatal(msg?: string): void;
    run(name: string, func: TestFunc): boolean;
}

T.skip()

The skip method marks the test as skipped and stops its execution.

T.fail()

The fail method marks the test as failed and continues it execution.

T.error(msg)

The error method reports an optional error message and marks the test as failed. If no msg parameter is provided, this function will be equivalent to calling fail.

T.fatal(msg)

The fatal method reports an optional error message and stops the test execution. This function is equivalent to calling error followed by returning from the test function.

T.run(name, func)

The run method start a subtest with the provided name. It basically has the same semantics as the test function. The return value reports whether the subtest succeeded or not.

Command Line

testsome [options] [file ...]

Run all tests which are defined in the provided files. A file could also be a glob pattern,
which includes every file the pattern matches.

Options:
    --run regexp
        Run only the test where the name matches the regular expression. All other will be ignored.
        The regular expression is split into parts by unbracketed slashes where each part must match
        the corresponding subtest. All parents of a matching test are run, too. For example, for
        '--run A/B' runs the test A with its subtests matching B.

Example

test.js

import {test} from "testsome";

test("my first test", t => {
    if(!initializeTest()) {
        t.fatal("cannot initialize test");
    }

    t.run("subtest", t => {
        if(somethingIsWrong) {
            t.error("something went wrong");
        }
    });
});

command line

testsome test.js