• Stars
    star
    126
  • Rank 284,543 (Top 6 %)
  • Language
    JavaScript
  • Created over 12 years ago
  • Updated almost 12 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Instrument JavaScript to determine the testing coverage

CoverJS (alpha)

Make sure all your code is tested, don't miss anything. CoverJS intruments your code. Using the instrumented code with your tests will result in a nice object, which can be passed through one of the reporters to create a nice graphical output of your code.

Instead of instrumenting lines (like JSCoverage), CoverJS will instrument statements, which should result in a more precise result.

Dependencies

Reporters

  • HTML
  • Text

CLI Usage

To instrument the code, CoverJS comes with a CLI tool:

coverjs --output cov/ file.js test/*

Reporting

The instrumented code should be executed to count the number of calls for each statement.

Usually your tests will try to cover each statement.

An example code that will capture the output and generate a HTML report would look like:

var HTMLReporter = require('../lib/reporters/HTMLReporter');

require('../test-cov/test/fixture.js');

var reporter = new HTMLReporter(global.__$coverObject);
console.log(reporter.report());

The output stream can be redirected to a file using

node test.js > report.html

so the result can be viewed in a browser

node

There are different templates with which what the instrumented code should start and end. For node there exists an template that saves the output as a JSON file, which can later be used as to generate a HTML report.

coverjs --template node --report ./cov.json file.js

With the coverjs-report tool, which reads from stdin, an HTML output can be generated:

cat ./cov.json | coverjs-report -r html > cov.html

See the prime Makefile for an example.

Screenshot

Screenshot

MIT License

Copyright (c) 2013 Arian Stolwijk

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

More Repositories

1

pngjs

Pure JavaScript PNG decoder
JavaScript
171
star
2

partition-bundle

A browserify plugin to partition your modules in different bundles
JavaScript
114
star
3

cubic-bezier

A small cubic bézier timing function
JavaScript
76
star
4

mootools-form-upload

Upload your multiple files with HTML5 Drag and Drop, XMLHttpRequest with graceful degradation
JavaScript
48
star
5

CSSMatrix

CSSMatrix polyfill
JavaScript
44
star
6

Array.Math

Add all kind of mathematical methods to the Array Native
JavaScript
33
star
7

Complex

Calculations with Complex Numbers in JavaScript
JavaScript
26
star
8

amd-packager-php

An CommonJS AMD Packager in PHP
JavaScript
25
star
9

MooDialog

MooDialog is a MooTools plugin to replace the native alert(), confirm() and promt() javascript functions by more stylish ones. You can use it also for other DOM elements, create an IFrame dialog or even create an Ajax Dialog.
JavaScript
23
star
10

LISP.js

Parse and run LISP code in JavaScript
JavaScript
15
star
11

DirectAdminApi

PHP DirectAdminApi is a wrapper for the DirectAdmin Api to make the usage of the Api simple as much as possible
PHP
14
star
12

graphql-kotlin-test-dsl

A Kotlin DSL to write tests for your graphql-java schema
Kotlin
13
star
13

iFrameFormRequest

iFrameFormRequest is a MooTools plug-in that can upload files the Ajax way
JavaScript
13
star
14

Rss-Parser

This is a simple PHP Rss Parser
PHP
12
star
15

classy

Brings the MooTools 1.x Class sugar to Prime
JavaScript
10
star
16

prime-util

Utilities for MooTools Prime
JavaScript
9
star
17

MooDropMenu

MooDropMenu provides a simple Drop Down menu with infinit levels for MooTools
JavaScript
7
star
18

mootools-ui-runner

A Testrunner for MooTools More in PHP
JavaScript
6
star
19

MooDocs

A simple php script to generate MooTools docs, so you can parse the MooTools 1.3 docs for yourself and you're able to help debug the Docs
PHP
5
star
20

G-pack-2.0

The Gourmand Planner, by Andrey Kolobov, Peng Dai, Mausam, and Dan Weld
C++
5
star
21

elements-util

Utilities for elements
JavaScript
5
star
22

scopup

JavaScript scope analysis for Mozilla Parser AST
JavaScript
4
star
23

Element.Delegation

This is a simple MooTools Plugin for Event Delegation, now I would suggest the MooTools More 1.3 Delegation though
JavaScript
4
star
24

MilkyTester

Simultaneous browser tester with Node.js, Socket.io and Jasmine
JavaScript
4
star
25

Supersonic

A small and supersonic flow-controll library for Node.js
JavaScript
3
star
26

docker-android-react-native

docker image for android and react-native tools
Dockerfile
3
star
27

elements-ui

ui components for elements.
JavaScript
3
star
28

Fx.Dynamic

JavaScript
3
star
29

hashmap

Educational hashmap implementation in C.
C
3
star
30

Klass

Yet Another Class
JavaScript
3
star
31

MooDeps

This is a MooTools dependency checker written in MooTools Javascript and PHP
PHP
2
star
32

grunt-wrapup

Grunt Plugin for MooTools Wrapup - Convert your node modules into web modules.
JavaScript
2
star
33

animateImage

AnimateImage is an MooTools plugin to create an animated image
JavaScript
2
star
34

es-safe-ie

Transforms obj.finally into obj['finally'] so it's safe in IE < 9
JavaScript
2
star
35

mootools-docs-node

A MooTools Documentation viewer in Node.js
JavaScript
2
star
36

Drag

Another Drag Implementation
JavaScript
2
star
37

MooResize

MooResize is a MooTools plugin to resize images and other elements in an easy way
JavaScript
2
star
38

go-qoi

QOI decoder and encoder implemented in Go
Go
2
star
39

ptrace

C
2
star
40

Element.Style.Transform

An abstracted API for CSS3 transforms
JavaScript
2
star
41

reactive

Reactive Programming in JavaScript?? (actually, I don't really know exactly what Reactive Programming is)
JavaScript
2
star
42

wrapup-webbuilder

A webbuilder for downloading wrapup'd JavaScript
JavaScript
2
star
43

npm-login-cmd

JavaScript
2
star
44

MooCss

With MooCss (MooTools plugin) you can write Css as Javascript objects (just like Element.Style) to a style tag in the document head
JavaScript
2
star
45

Locale.AutoUse

Automatically determine the right language of the document to use for Locale
JavaScript
1
star
46

dom-binding

DOM data binding, push your objects to the DOM
JavaScript
1
star
47

node-sass-cli

Better CLI for node-sass
JavaScript
1
star
48

wrapup-middleware

Wrapup middleware for express.
JavaScript
1
star
49

metac

A MetaC to C compiler using Spoofax
TypeScript
1
star
50

version.is-sources

Source repo for version-is/version.is
1
star
51

packager-nightly

Download and build from github with packager, can be used with github hooks
PHP
1
star
52

selenium-wrapper

A selenium server wrapper, including installation and chrome webdriver
JavaScript
1
star
53

JAMD

Ported AMD-Packager-PHP to Java! To build and optimize your AMD modules into single files
Java
1
star
54

procs

Stupid Markdown to HTML documentation tool
JavaScript
1
star
55

vim

just showing my vim noobness
Vim Script
1
star
56

node-testbox

Run your tests in a sandboxed iframe
JavaScript
1
star
57

envarconst

Make JavaScript const variable, using esprima to change const declarations in your code, so a minifier like UgilfyJS can remove dead code.
JavaScript
1
star