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

@singleware/testing

v1.0.1

Published

Singleware testing package.

Readme

Testing

This package provides a simple way to automate your test scripts.

How to use

First you need to create your test case, all test cases must extends the library test case, see below

import * as Class from '@singleware/class';
import * as Testing from '@singleware/testing';

@Class.Describe()
export class MyTestCase extends Testing.Case {
  @Class.Public()
  @Testing.Method()
  public testMethod(): void {
    // Assertions here...
  }
}

After you need to create the suite runner, the suite runner script can be similar the code below

import * as Testing from '@singleware/testing';

import { MyTestCase } from './mytestcase.spec';

const suite = new Testing.Suite();

suite.addCase(MyTestCase);

suite.perform().then((report: Testing.Report.Suite) => {
  const logger = new Testing.Loggers.Tap();
  logger.print(report);
  process.exitCode = report.errors > 0 ? 1 : 0;
});

For browser compatibility, remove the line process.exitCode

Now you are ready to add assertions in your test case, you can add as many assertions as you want, after that you just need to build and run the suite script like any JavaScript file.

Assertions

The package provides a collection of assertion methods to help you to test expected values and put its results in the report object. Any assertion method can be accessed by the test case instance using the keyword this.

| Name | Description | | -------------------- | -------------------------------------------------------------------------------- | | isTrue | Determines whether the specified condition is true. | | isFalse | Determines whether the specified condition is false. | | isNaN | Determines whether the specified value is NaN. | | isNull | Determines whether the specified value is null. | | isInfinite | Determines whether the specified value is infinite. | | isUndefined | Determines whether the specified value is undefined. | | isEmpty | Determines whether the specified value is empty. | | isBoolean | Determines whether the specified value is a boolean type. | | isString | Determines whether the specified value is a string type. | | isNumber | Determines whether the specified value is a number type. | | isArray | Determines whether the specified value is an array type. | | isInstanceOf | Determines whether the specified value is an instance of the expected type. | | isGreaterThan | Determines whether the actual is greater than the expected value. | | isGreaterThanOrEqual | Determines whether the actual value is greater than or equal the expected value. | | isLessThan | Determines whether the actual value is less than the expected value. | | isLessThanOrEqual | Determines whether the actual value is less than or equal the expected value. | | areEquals | Determines whether the specified values are equals. | | areNotEquals | Determines whether the specified values are not equals. | | areSame | Determines whether the specified values and types are the same. | | areNotSame | Determines whether the specified values and types are not the same. | | hasIndex | Determines whether the specified array has the expected index. | | hasProperty | Determines whether the specified object has the expected property. | | hasMethod | Determines whether the specified object has the expected method. | | hasValue | Determines whether the specified array contains the given value. | | hasOnly | Determines whether the specified array contains only the expected value. | | hasException | Determines whether the specified callback throws an expected exception. |

Report

After performing all test cases, the library will generates a report object that can be converted to multiple output formats, you can check the Loggers namespace to see which output formats are available for your current version.

Install

Using npm:

npm i @singleware/testing

License

MIT © Silas B. Domingos