2.0.15 • Published 8 years ago

build-test v2.0.15

Weekly downloads
15
License
UNLICENSED
Repository
github
Last release
8 years ago

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:

OptionDescription
<files>A glob pattern that identifies files that contain unit tests. Multiple glob patterns can be specified.
-cA glob pattern that identifies files to produce code coverage metrics for. Multiple glob patterns can be specified.
-fThe format for the output. Options are: console, file.
-oThe directory to send output to. This defaults to testResults/.
-rA modue to require before any tests are run.
-wWhen present the files specified in the files glob pattern(s) will be watched for changes and tested when they do change.
--branchesGlobal branch coverage threshold when code coverage is performed.
--functionsGlobal function coverage threshold when code coverage is performed.
--linesGlobal line coverage threshold when code coverage is performed.
--statementsGlobal statement coverage threshold when code coverage is performed.
2.0.15

8 years ago

2.0.14

8 years ago

2.0.13

8 years ago

2.0.12

8 years ago

2.0.11

8 years ago

2.0.10

8 years ago

2.0.9

8 years ago

2.0.8

8 years ago

2.0.7

8 years ago

2.0.6

8 years ago

2.0.5

8 years ago

2.0.4

8 years ago

2.0.3

8 years ago

2.0.2

8 years ago

2.0.1

8 years ago

2.0.0

8 years ago

1.0.9

8 years ago

1.0.8

8 years ago

1.0.7

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago