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

ts-x-unit

v0.15.0

Published

TypeScript xUnit testing framework implementation.

Readme

TSxUnit

Because we can.

Build Status npm version Downloads bitHound Overall Score codecov

Usage

Tell everyone about your TypeScript Test Driven Project!

In Your Project

See sample of usage: in micro-bench project.

  1. Install ts-x-unit with npm

    $ npm install ts-x-unit --save-dev
  2. Add next tasks to npm scripts: 3.1. Task for build suite cases launch map from your test-classes:

    "suite-builder": "suite-builder",

    3.2. Update LaunchMap and compile all tests before run tests:

    "pretest": "suite-builder tests/ && tsc",

    3.3. Run tests in suite:

    "test": "node tests/suite.js"

Now, you can use one simple command npm test for rebuild and run you tests!

Conventions:

Your test-classes must:

  1. extend one of next base classes:
    • AbstractUnitTestCase
    • AbstractDomTestCase
  2. end with "Test.ts", for example FooBarTest.ts
  3. test methods must be starting with "test" prefix, for example public testCalculateValue(){}

Workflow

See more info in project wiki on github.

AbstractUnitTestCase

Base test class has basic assertions and can be useful for unit-testing environment independent (or Node.js code). You can use mockBuilder for prepare Fake objects, based on abstract or normal TypeScript classes and JavaScript Objects. This Builder based on JSMockito.

AbstractDomTestCase

AbstractDomTestCase extend AbstractUnitTestCase and designed for test client-side code. It contain assertions for DOM inspection, like assertElementHasClass(), assertElementExists(), assertElementsCount() etc. For create virtual Document use DocumentBuilder: it can prepare document with HTML-fixture from local file or url. Also you can create Window with WindowBuilder and Location object with LocationBuilder, dispatch Events and make most manipulation with DOM in tests runned from CLI, without real browser.
This implementation based on jsdom.

How it's work?

After your complete all installation steps, npm task test in your package.json run file tests/suite.js. Pretest task call LaunchBuilder: it collect all *Test.ts files, generate map of test cases and compile all test code from TS to JS.

For Contributors:

Clone this repo:

$ git clone [email protected]:FreeElephants/TSxUnit.git 

Install dependencies:

$ npm install

To run tests use:

$ npm test

This script (re-)build launch-builder tool, update LaunchMap, compile and run tests, compute coverage. See package.json for details.

Test coverage (interactive)

Cover your project with TSxUnit

Install istanbul and remap-istanbul:

npm install istanbul remap-istanbul --save-dev

Add task as npm script:

"scripts": {
    ...
    "istanbul": "istanbul",
    "remap-istanbul": "remap-istanbul",
    "coverage": "npm run pretest && rm -rf coverage/* && istanbul cover tests/suite.js && remap-istanbul --input coverage/coverage.json --output coverage/html-report --type html && remap-istanbul --input coverage/coverage.json --output coverage/coverage-final.json"
    ...

Configure you tests transpiling with sourceMap:

# update package.json
"scripts": {
    ...
    "pretest": "suite-builder tests/ && tsc && tsc tests/suite.ts --sourceMap",
    ...
}

# or via tests/tsconfig.json:
{
  "compilerOptions": {
    ...
    "sourceMap": true
    ...
    },
    ...
}

Now you can run tests with coverage analysis:

npm run coverage

Current state of project

Click on graph, and it will opens separately. You can click any rectangle to see code coverage of represented class.

Test coverage grapth

See ROADMAP for planned features.