# node-jscover
**Repository Path**: mirrors_yiminghe/node-jscover
## Basic Information
- **Project Name**: node-jscover
- **Description**: No description available
- **Primary Language**: Unknown
- **License**: Not specified
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2020-08-19
- **Last Updated**: 2026-03-14
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
## node-jscover - - A JavaScript code coverage measurement tool
[](https://npmjs.org/package/node-jscover)
[](https://npmjs.org/package/node-jscover)
[](https://travis-ci.org/yiminghe/node-jscover)
[](https://coveralls.io/r/yiminghe/node-jscover?branch=master)
node version of [JSCover](https://github.com/tntim96/JSCover). only support file system instrument.
### use command line tools
* install jscover globally
``` javascript
npm install node-jscover -g
```
* instrument supplied directory of javascript files(**/lib**) and save result to another directory(**/out**)
```
jscover -d /lib -o /out
```
similar to java version:
```
java -jar JSCover-all.jar -fs /lib /out
```
* all arguments
| short name |
full name |
type |
default |
description |
| -d |
--dir |
String |
|
directory of javascript source files |
| -o |
--out |
String |
|
destination directory of instrumented javascript source files |
| -f |
--front |
Boolean |
false |
whether output JSCover front-end files to destination directory |
### usage doc
[https://github.com/yiminghe/node-jscover/blob/master/docs/usage.md](https://github.com/yiminghe/node-jscover/blob/master/docs/usage.md)
### use api
* install jscover locally
``` javascript
npm install node-jscover
```
* get jscover
``` javascript
var jscover = require('node-jscover');
```
#### method
##### String instrument(String code, String fileName): return instrumented code
| name |
type |
description |
| code |
String |
code to be instrumented |
| fileName |
String |
fileName of code |
example
``` javascript
var jscover = require('node-jscover');
console.log(jscover.instrument('var x=1;','test.js'));
// -> _$jscoverage['test.js'].lineData[0]++;
// -> var x = 1;
```
### example


### changelog
#### 0.6.0
* add console reporter for mocha and jasmine: /lib/reporters/...
#### 0.5.0
* change function count format: https://github.com/yiminghe/node-jscover/issues/1
#### 0.4.0
* compatible with [jscover](https://github.com/tntim96/JSCover)
* [support function count](https://github.com/yiminghe/node-jscover/issues/1)