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

xjs-test

v1.1.0

Published

simple testing framework for typescript modules.

Readme

npm CI publish

Overview

simple testing framework for typescript modules.
this has been used for xjs series like xjs-common.

Install

npm i xjs-test --save-dev

Code example (only part)

below is a part of actual unit test in xjs-common.
there is more code examples as actual tests in here.

const mt = new ModuleTest("T_U");
mt.appendUnit("retry", function (this: TestUnit<{
    counter: number,
    errorCount: number,
    array: number[];
    cb?: () => any,
    cbAsync?: () => Promise<any>
}>) {
    this.chainContextGen(c => ({
        counter: 0,
        errorCount: 2,
        array: [],
        cb: () => { c.counter += 1; return c.counter; }
    }));
    this.appendCase("result value from callback is returned correctly.", function (this: TestCase, c) {
        this.check(retry(c.cb, { count: 2, logger: s_emptyLogger }) === 1);
    });
    this.chainContextGen(c => ({
        cb: () => {
            c.counter += 1;
            if (c.counter <= c.errorCount) throw c.counter;
            return c.counter;
        }
    }));
    this.appendCase("callback is retried by default retryable count correctly.", function (this: TestCase, c) {
        this.expectError(e => e === 2);
        retry(c.cb, { logger: s_emptyLogger });
    });
    this.appendCase("specified retry count is working.", function (this: TestCase, c) {
        const ret = retry(c.cb, { count: 2, logger: s_emptyLogger });
        this.check(ret === 3);
    });
    this.chainContextGen(c => ({
        cbAsync: async () => {
            c.array.push(c.counter);
            await delay(0.001).then(() => c.counter += 1);
            if (c.counter <= c.errorCount) throw 1;
            return c.counter;
        }
    }));
    this.appendCase("async callback is working.", async function (this: TestCase, c) {
        const ret = await retry(c.cbAsync, { count: 2, logger: s_emptyLogger });
        this.check(ret === 3);
    });
    this.appendCase("error criterion is working.", async function (this: TestCase, c) {
        try { await retry(c.cbAsync, { errorCriterion: e => e != 1, logger: s_emptyLogger }); } catch { /** pass here is correct. */ }
        this.check(c.counter === 1);
    });
    this.appendCase("interval predicate is working.", async function (this: TestCase, c) {
        try {
            await retry(c.cbAsync, {
                intervalPredicate: () => delay(0.001).then(() => c.array.push(-1)),
                errorCriterion: e => e === 1, logger: s_emptyLogger, count: 2
            });
        } catch { }
        this.check(UArray.eq(c.array, [0, -1, 1, -1, 2], { sort: false }));
    });
    this.chainContextGen(() => ({
        cb: () => { throw 1; },
        array: [Date.now()]
    }));
    this.appendCase("intervalSec is working.", async function (this: TestCase, c) {
        try {
            await retry(c.cb, {
                intervalSec: 0.5,
                intervalPredicate: () => c.array.push(Date.now()),
                errorCriterion: e => e === 1, logger: s_emptyLogger, count: 2
            });
        } catch { }
        this.check(c.array[2] - c.array[1] >= 500 && c.array[1] - c.array[0] < 500);
    });
}, { concurrent: true });
mt.exe();

License

Apache-License