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

@premiss/api

v1.0.2

Published

TypeScript testing library

Downloads

17

Readme

Premiss

test status coverage CC0-1.0 npm typescript

Premiss is a testing library written in TypeScript to provide an API for testing code. It is not a framework, therefore it does not provide a cli, runner, assertions, test doubles, or other integrations. The library provides an interface to represent the “Arrange-Act-Assert” testing pattern, with the addition of “Annul” for what should be the rare case you need to clean up.

Table of Contents

Motivation

There are two main reasons for this project. The first is most of what’s out there for testing are frameworks and I try to avoid frameworks. The other is an intent to keep a single test cohesive through constraining the shape of the test so that it has a single reason to exist. And as a side bonus, I used this as an opportunity to use the TCR workflow to build this.

Example

String Calcluator Kata Example

API Reference

The API has a single entry point, the verify function. The verify function takes a proof interface, evaluates it, and returns a proof examination result. The result contains the outcome of the examination along with timings. The examination outcome indicates if the proof passed or failed and when failed the step the failure occurred at. Only the assert method signature is required.

Implementations

A class implementation of the proof interface

import { Proof } from "@premiss/api";

export class YourAmazingTest implements Proof
{
    public async arrange(): Promise<void>
    {
        // Set up for winning
    }

    public async act(): Promise<void>
    {
        // Execute the winning
    }

    public async assert(): Promise<void>
    {
        // Count your winnings
    }

    public async annul(): Promise<void>
    {
        // Give you winnings away?
        // No really why do you have to clean up?
    }
}

An object literal implementation of the proof interface

import { Proof, ProofStep } from "@premiss/api";

export const YourAmazingTest =
    {
        [ProofStep.arrange]: async (): Promise<void> =>
        {
            // Set up for winning
        },

        [ProofStep.act]: async (): Promise<void> =>
        {
            // Execute the winning
        },

        [ProofStep.assert]: async (): Promise<void> =>
        {
            // Count your winnings
        },

        [ProofStep.annul]: async (): Promise<void> =>
        {
            // Give your winnings away?
            // No really why do you have to clean up?
        }
    }

The minimum proof interface implementation

import { Proof } from "@premiss/api";

export class YourAmazingTest implements Proof
{
    public async assert(): Promise<void>
    {
        // Count your winnings
    }
}

Running a test

import { verify } from "@premiss/api";

const myTestResult = (async (): Promise<TimedResult<ProofExaminationResult>> => {
    // new up your test
    const proof = new YourAmazingTest();
    // run your test
    return await verify(proof);
})();
// do what you want with your test results

Test result variations

A passing test result with no annul defined

{
    elapsedNanoseconds: 1292900n,
    result: 
    {
        examinationOutcome: ExaminationOutcomeObserved.passed,
        examinationResultSet: 
        {
            arrange: 
            {
                elapsedNanoseconds: 132401n,
                result: 
                {
                    examinationOutcome: ExaminationOutcomeObserved.passed
                }
            },
            act: 
            {
                elapsedNanoseconds: 568600n,
                result: 
                {
                    examinationOutcome: ExaminationOutcomeObserved.passed
                }
            },
            assert: 
            {
                elapsedNanoseconds: 65301n,
                result: 
                {
                    examinationOutcome: ExaminationOutcomeObserved.passed
                }
            },
            annul: 
            {
                elapsedNanoseconds: 0n,
                result: 
                {
                    examinationOutcome: ExaminationOutcomeUnobserved.skipped
                }
            },
            elapsedNanoseconds: 766302n
        }
    }
}

A failing test result with successful annul step

{
    elapsedNanoseconds: 1422101n,
    result: 
    {
        examinationOutcome: ExaminationOutcomeObserved.failed,
        examinationError: 
        {
            error:
            {
                generatedMessage: false,
                code: "ERR_ASSERTION",
                actual: 1003,
                expected: 2,
                operator: "strictEqual",
                message: "The assertion error message"
            },
            proofStep: ProofStep.assert
        },
        examinationResultSet: 
        {
            arrange: 
            {
                elapsedNanoseconds: 132401n,
                result: 
                {
                    examinationOutcome: ExaminationOutcomeObserved.passed
                }
            },
            act: 
            {
                elapsedNanoseconds: 568600n,
                result: 
                {
                    examinationOutcome: ExaminationOutcomeObserved.passed
                }
            },
            assert: 
            {
                elapsedNanoseconds: 65301n,
                result: 
                {
                    examinationOutcome: ExaminationOutcomeObserved.failed,
                    examinationError: 
                    {
                        error:
                        {
                            generatedMessage: false,
                            code: "ERR_ASSERTION",
                            actual: 1003,
                            expected: 2,
                            operator: "strictEqual",
                            message: "The assertion error message"
                        },
                        proofStep: ProofStep.assert
                    }
                }
            },
            annul: 
            {
                elapsedNanoseconds: 129201n,
                result: 
                {
                    examinationOutcome: ExaminationOutcomeObserved.passed
                }
            },
            elapsedNanoseconds: 895503n
        }
    }
}

Some words

premiss verb

  • to set fourth beforehand as an introduction or a postulate
     

pre- prefix

  • earlier than : prior to : before

miss verb

  • to fail

License

CC0