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

@mitchell-collins/tester

v2.4.4

Published

Used to test code

Downloads

3

Readme

Tester

A npm package that is used to create Tester objects that test a code.

Install Package:

npm i @mitchell-collins/tester 

Constructors

The are multiply different testers these include:

  • Tester - the super class that defines the attributes name and description
  • FunctionTester - a parent class whos children are used for testing functions, it defines the attributes function and inputOutputSamples
  • ReturnTester - is a child class of FunctionTester, used to test functions that return a output
  • LogTester - is a child class of FunctionTester, used to test functions that log an output to the console
  • RouteTester - is used to test a route of a server
  • TesterManager - is used to manager your testers

TesterManager

A TesterManager is already constructor and exported as default and is used to manage all your testers. All the testers are stored into a object that is looped through to run each tester. The TesterManager is also exported which allows you to create multiple TesterManagers.

Types

type ReturnTesterSample = {
    inputs: any[],
    output: any
}
type LogTesterSample = {
    inputs: any[],
    outputs: any[]
}
type RouteTesterOutput = {
    data: any,
    status: HttpStatusCode
}
type RouteTesterMethods = "get" | "post" | "put" | "patch" | "delete";
type RouteTest = {
    output: RouteTesterOutput,
    body?: object | null,
    config?: AxiosRequestConfig<any> | null,
    params?: object | null,
    querys?: object | null
}

Example

testerManager.createReturnTester(
    "Sum Tester",
    "tests the addNumbers function",
    function addNumbers(num1, num2) {
        return num1 + num2;
    },
    [
        {
            inputs: [2, 5], 
            output: 7
        },
        {
            inputs: [7, 3], 
            output: 10
        },
        {
            inputs: [12, 7], 
            output: 19
        }
    ]
);

testerManager.createLogTester(
    "Subtract Tester",
    "tests the subtractNumbers function",
    function subtractNumbers(num1, num2) {
        console.log(num1);
        console.log(num2);
        console.log(num1 - num2);
    },
    [
        {
            inputs: [3, 1], 
            outputs: [3, 1, 2]
        },
        {
            inputs: [7, 4], 
            outputs: [7, 4, 3]
        },
        {
            inputs: [10, 5], 
            output: [10, 5, 5]
        }
    ]
);

testerManager.createRouteTester(
    "Route ID Tester",
    "tests the get name route",
    "example.url/name/:id",
    RouteTesterMethods.GET,
    [
        {
            output: { 
                data: { 
                    name: "Jack"
                },
                status: 200
            },
            params: { id: 1 }
        },
        {
            output: { 
                data: {
                    name: "John" 
                },
                status: 200
            },
            params: { id: 2 }
        },
        {
            output: { 
                data: {
                    name: "Ben" 
                },
                status: 200
            },
            params: { id: 3 }
        }
    ]
);

testerManager.run();

Exports

ESModule & CommonJS

  • .
    • testerManager as default
    • TesterManager
    • Tester
    • FunctionTester
    • RouteTester
    • RouteTest
    • RouteTesterMethods
    • RouteTesterOutput
    • HttpStatusCode
    • AxiosRequestConfig
    • LogTesterSample
    • LogTester
    • ReturnTesterSample
    • ReturnTester

Only CommonJS

  • ./Tester
    • Tester as default
  • ./FunctionTester
    • FunctionTester as default
  • ./ReturnTester
    • ReturnTester as default
  • ./LogTester
    • LogTester as default
  • ./RouteTester
    • RouteTester as default
  • ./TesterManager
    • TesterManager as default

Dependencies

  • axios
    • https://github.com/axios/axios
    • https://www.npmjs.com/package/axios
  • @mitchell-collins/validator
    • https://github.com/MitchellCollins/validator
    • https://www.npmjs.com/package/@mitchell-collins/validator
  • @mitchell-collins/superclass
    • https://github.com/MitchellCollins/SuperClass
    • https://www.npmjs.com/package/@mitchell-collins/superclass