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

build-test

v2.0.15

Published

Testing command line tool.

Readme

build-test

This package is currently in BETA

Overview

This is a command line tool that performs testing and code coverage. It uses mocha to perform testing and istanbul to perform code coverage.

Guide

To start you will need to install this package for your project by executing the following command within your project from the console.

npm install --save-dev build-test

Once the package is installed you can run the tool from a terminal using the build-test command. Normally you will do this within an npm script element. Take the following excerpt from an example package.json file:

{
  "scripts": {
    "test": "build-test \"src/tests/*.spec.js\" -c \"src/**/*.js\" -c \"!src/tests/**/*.js\" ",
    "test-watch": "build-test \"src/tests/*.spec.js\" -c \"src/**/*.js\" -c \"!src/tests/**/*.js\" -w",
  }
}

In the example above the test script will run the tests found in files that end with a .spec.js extension within the src/tests/ folder. It will also provide code coverage metrics for files with an extension of .js within the src/ but not the src/tests/ folder. The test-watch script will perform testing for the same .spec.js files whenever one of them is updated or added.

Also notice that the glob patterns are surrounded by double quotes. This is necessary in order to prevent the terminal from expanding the glob patterns into actual file paths.

API

Usage:

build-test <files> [<files>] [-c <files>]  
           [-o <out directory>] [-w] [-f <format>] [-r <module>]  
           [--branches <number>] [--functions <number>] [--lines <number>] [--statements <number>]

Options:

| Option | Description | | --- | --- | | <files> | A glob pattern that identifies files that contain unit tests. Multiple glob patterns can be specified. | | -c | A glob pattern that identifies files to produce code coverage metrics for. Multiple glob patterns can be specified. | | -f | The format for the output. Options are: console, file. | | -o | The directory to send output to. This defaults to testResults/. | | -r | A modue to require before any tests are run. | | -w | When present the files specified in the files glob pattern(s) will be watched for changes and tested when they do change. | | --branches | Global branch coverage threshold when code coverage is performed. | | --functions | Global function coverage threshold when code coverage is performed. | | --lines | Global line coverage threshold when code coverage is performed. | | --statements | Global statement coverage threshold when code coverage is performed. |