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

@kompanie/testwerk

v2.1.1

Published

A dependency-free, buildless test runner for browsers and node.js

Readme

Testwerk 🏭

A dependency-free, buildless test runner for browsers and node.js environments.

Getting Started

At first you need to install the package using the following command:

npm i @kompanie/testwerk

Writing tests

Tests are organized into classes. Each public function is treated as a test. If you need helper functions inside your test class, use private functions. Async functions are also supported and will automatically fail if they reach the configured asyncTestTimeout.

The following examples use @kompanie/assert. You can use any other assertion library that throws errors if an assertion fails.

import { Assert } from "@kompanie/assert";

export class MyTests {
    add_shouldCorrectlyAdd() {
        const actual = 1 + 1;

        Assert.equal(actual, 2);
    }

    async async_add_shouldCorrectlyAdd() {
        await new Promise(resolve => setTimeout(resolve, 1000));
        const actual = 1 + 1;

        Assert.equal(actual, 2);
    }

    #myHelperFunction() {
        // I'm not treated as test
    }

    afterAll() {
        // Executed after all tests are finished
    }

    afterEach() {
        // Runs after each individual test
    }

    beforeAll() {
        // Runs before test execution starts
    }

    beforeEach() {
        // Runs before each individual test
    }
}

Running tests

Your tests can be executed and visualized either as HTML (browser) or in the console (browser or node.js).

Running tests with HTML output

import { TestRunnerHtml } from "@kompanie/testwerk";
import { MyTests } from "./tests/myTest.js";

const runnerConfig = {
    asyncTestTimeout: 5000,
    afterEachTimeout: 500,
    beforeEachTimeout: 500 
}; // Optional, these are the defaults

const testResultContainer = document.getElementById("test-result-container");
const testRunnerHtml = new TestRunnerHtml(runnerConfig);
testRunnerHtml.run(testResultContainer, MyTest); // Add your test classes here. No array declaration needed.

Running tests with console output

import { TestRunnerConsole } from "@kompanie/testwerk";
import { MyTests } from "./tests/myTest.js";

const runnerConfig = {
    asyncTestTimeout: 5000,
    afterEachTimeout: 500,
    beforeEachTimeout: 500 
}; // Optional, these are the defaults

const testRunnerConsole = new TestRunnerConsole(runnerConfig);
testRunnerConsole.run(MyTest); // Add your test classes here. No array declaration needed.

Running tests without visual output

You can also use your own code to parse and visualize the output of TestRunner.

import { TestRunner } from "@kompanie/testwerk";
import { MyOtherTests } from "./tests/myOtherTests.js";

const runnerConfig = {
    asyncTestTimeout: 5000,
    afterEachTimeout: 500,
    beforeEachTimeout: 500 
}; // Optional, these are the defaults

const testRunner = new TestRunner(runnerConfig);
const testResults = await testRunner.run(MyOtherTests); // Add your test classes here. No array declaration needed.

This example shows what testResults can look like.

{
    "completionTime": 1739974557847,
    "executionTime": 3014,
    "testResults": [
        {
            "name": "MyOtherTests",
            "results": [
                {
                    "name": "throws_shouldFail_whenFunctionDoesNotThrowAsync",
                    "executionTime": 0,
                    "error": {
                        "columnNumber": 8,
                        "fileName": "http://localhost:8000/source/assert.js",
                        "lineNumber": 1,
                        "message": "Expected an error, but none was thrown",
                        "stack": "AssertionError@http://localhost:8000/source/assert.js:1:8..."
                    }
                },
                {
                    "name": "throws_shouldPass_whenFunctionThrowsAsync",
                    "executionTime": 2
                }
            ]
        }
    ]
}

Test project

Testwerk includes tests which can be run with the following command:

npm test

You can then open your browser. The test project outputs to the console and HTML. It also has three failing tests to show the visualization of failed tests in the console and the HTML.