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

@sendanor/sstest

v0.9.2

Published

Sendanor's Simple Test Runner

Readme

sendanor/sstest

This project is extremely simple unit test runner for NodeJS.

  • It can run tests written in JavaScript (or TypeScript)
  • It's less than 200 lines of code
  • It has zero runtime dependencies -- and only three (3!) development dependencies, NodeJS included
  • It does not need configuring
  • It runs on NodeJS v14 LTS and newer (but maybe older too)

Background

It was made from the frustration of setting up Mocha & etc for a new project, which also bring your project extra 109 packages as a dependency, and often this needless effort is the only reason why my project doesn't have unit tests and takes a lot of disk space (not to mention security issues and the work needed to audit that).

It took me less than two hours of work and one can of Nocco to implement it -- which is much less than setting up fully working Mocha setup.

What it is not

It doesn't include any asserting library, spies, fakes, or anything like that, since it's not the job for a test runner.

I suggest using SinonJS for writing tests, but you may even use Node's assert module.

Example test

If you're testing DlInstance class, create a file named DlInstanceTest and write your tests as static functions:

import AssertUtils from "./AssertUtils";

export class DlInstanceTest {

    public static firstTest () {

        AssertUtils.equals(1, 2);

    }

}

How to install

You can install it using NPM:

npm i -D @sendanor/sstest

If you want the latest non-stable version directly from our Github:

npm i -D sendanor/sstest

How to run your tests

You'll need to tell sstest where to look for compiled JavaScript test files.

These are any files named *Test.js.

If you use a build system like TypeScript, then direct the test runner to look files from the ./dist folder.

$ sstest ./dist
1 (of 1) tests failed:

[/Users/jhh/git/sendanor/dldb/dist/DlInstanceTest.js] DlInstanceTest.firstTest failed:  TypeError: Values were not equal: 1 !== 2
    at Function.AssertUtils.equals (/Users/jhh/git/sendanor/dldb/dist/AssertUtils.js:9:19)
    at Function.DlInstanceTest.firstTest (/Users/jhh/git/sendanor/dldb/dist/DlInstanceTest.js:9:34)
    at /Users/jhh/git/sendanor/dldb/dist/test.js:46:59
    at Array.forEach (<anonymous>)
    at /Users/jhh/git/sendanor/dldb/dist/test.js:30:33
    at Array.forEach (<anonymous>)
    at TestRunner.testFile (/Users/jhh/git/sendanor/dldb/dist/test.js:26:23)
    at Array.forEach (<anonymous>)
    at Function.TestRunner.testDirectory (/Users/jhh/git/sendanor/dldb/dist/test.js:63:29)
    at Object.<anonymous> (/Users/jhh/git/sendanor/dldb/dist/test.js:111:12) 

Example integration with package.json

You can add your scripts section to include "test": "sstest ./dist".

Then you may then use npm test to test your files:

$ npm test

> [email protected] test /Users/jhh/git/sendanor/dldb
> sstest ./dist

ERROR: 1 (of 1) tests failed:

[/Users/jhh/git/sendanor/dldb/dist/DlInstanceTest.js] DlInstanceTest.firstTest failed:  TypeError: Values were not equal: 1 !== 2
    at Function.AssertUtils.equals (/Users/jhh/git/sendanor/dldb/dist/AssertUtils.js:9:19)
    at Function.DlInstanceTest.firstTest (/Users/jhh/git/sendanor/dldb/dist/DlInstanceTest.js:9:34)
    at /Users/jhh/git/sendanor/sstest/dist/SSTestRunner.js:48:59
    at Array.forEach (<anonymous>)
    at /Users/jhh/git/sendanor/sstest/dist/SSTestRunner.js:32:33
    at Array.forEach (<anonymous>)
    at TestRunner.testFileInDir (/Users/jhh/git/sendanor/sstest/dist/SSTestRunner.js:28:23)
    at Array.forEach (<anonymous>)
    at Function.TestRunner.testDirectory (/Users/jhh/git/sendanor/sstest/dist/SSTestRunner.js:68:29)
    at /Users/jhh/git/sendanor/sstest/dist/sstest.js:24:64 

npm ERR! Test failed.  See above for more details.