UNPKG

5.41 kBMarkdownView Raw
1# Blanket.js
2
3A seamless JavaScript code coverage library.
4
5**FYI: Please note that this repo is not actively maintained**
6
7**If you're looking for a more active project for JavaScript code coverage, I recommend [Istanbul](https://github.com/gotwarlost/istanbul).**
8
9
10[Project home page](http://blanketjs.org/)
11[Blanket_js on Twitter](http://www.twitter.com/blanket_js) for updates and news.
12
13**NOTE: All Pull-Requests must be made into the `master` branch.**
14
15
16[![Build Status](https://travis-ci.org/alex-seville/blanket.svg)](https://travis-ci.org/alex-seville/blanket)
17[![Dependency Status](https://david-dm.org/alex-seville/blanket.svg)](https://david-dm.org/alex-seville/blanket)
18[![devDependency Status](https://david-dm.org/alex-seville/blanket/dev-status.svg)](https://david-dm.org/alex-seville/blanket#info=devDependencies)
19
20* [Getting Started](#getting-started)
21* [Philosophy](#philosophy)
22* [Mechanism](#mechanism)
23* [Grunt Integration](#grunt-integration)
24* [Compatibility & Features List](#compatibility-and-features-list)
25* [Roll Your Own](#roll-your-own)
26* [Development](#development)
27* [Contact](#contact)
28* [Contributors](#contributors)
29* [Revision History](#revision-history)
30
31**NOTE:** Blanket.js will throw XHR cross domain errors if run with the file:// protocol. See [Special Features Guide](docs/special_features.md) for more details and workarounds.
32
33
34## Getting Started
35
36Please see the following guides for using Blanket.js:
37
38**Browser**
39* [Getting Started](docs/getting_started_browser.md) (Basic QUnit usage)
40* [Intermediate](docs/intermediate_browser.md) (Other test runners, global options)
41* [Advanced](docs/advanced_browser.md) (writing your own reporters/adapters)
42* [Special Features Guide](docs/special_features.md)
43
44**Node**
45* [Getting Started](docs/getting_started_node.md) (basic mocha setup)
46* [Intermediate](docs/intermediate_node.md) (mocha testrunner, travis-ci reporter)
47* [Intermediate 2](docs/intermediate_node_2.md) (mocha, htmlcov, package.json setup)
48
49**Configuration**
50* [Options](docs/options.md) (Browser and Node)
51
52
53## Philosophy
54
55Blanket.js is a code coverage tool for javascript that aims to be:
56
571. Easy to install
582. Easy to use
593. Easy to understand
60
61Blanket.js can be run seamlessly or can be customized for your needs.
62
63
64## Mechanism
65
66JavaScript code coverage compliments your existing JavaScript tests by adding code coverage statistics (which lines of your source code are covered by your tests).
67
68Blanket works in a 3 step process:
69
701. Loading your source files
712. Parsing the code using [Esprima](http://esprima.org) and [node-falafel](https://github.com/substack/node-falafel), and instrumenting the file by adding code tracking lines.
723. Connecting to hooks in the test runner to output the coverage details after the tests have completed.
73
74## Grunt Integration
75
76You've got a few options for using Grunt with Blanket:
77
78**grunt-blanket**
79
80A Grunt plugin has been created to allow you to use Blanket like a "traditional" code coverage tool (creating instrumented copies of physical files, as opposed to live-instrumenting).
81The plugin runs as a standlone project and can be found [here](https://github.com/alex-seville/grunt-blanket).
82
83**grunt-blanket-qunit**
84
85Runs the QUnit-based Blanket report headlessly using PhantomJS. Results are displayed on the console, and the task will cause Grunt to fail if any of your configured coverage thresholds are not met. Minimum code coverage thresholds can be configured per-file, per-module, and globally.
86
87See:
88
89* [Plugin Repo](https://github.com/ModelN/grunt-blanket-qunit)
90* [Blog Walkthrough](http://www.geekdave.com/2013/07/20/code-coverage-enforcement-for-qunit-using-grunt-and-blanket/)
91
92## Compatibility and Features List
93
94See the [Compatiblity and Feature List](https://github.com/alex-seville/blanket/blob/master/docs/compatibility_and_features.md) including links to working examples.
95
96
97## Roll your own
98
991. `git clone git@github.com:alex-seville/blanket.git`
1002. `npm install`
1013. Add your custom build details to the grunt.js file under `concat`
1023. `npm run build`
103
104A minified and unminfied copy of the source can be created (see the `min` task).
105
106
107## Development
108
109**All development takes place on the `master` branch**
110**Your pull request must pass all tests (run `npm test` to be sure) and respect all existing coverage thresholds**
111
112
113## Contact
114
115Feel free to add questions to the Issue tracker, or send them to [@blanket_js](http://www.twitter.com/blanket_js).
116
117
118## Contributors
119
120Thanks to the [many people who have contributed](https://github.com/alex-seville/blanket/network/members) to the project.
121
122And thanks also to: [RequireJS](http://requirejs.org/), [Esprima](http://esprima.org/), [node-falafel](https://github.com/substack/node-falafel), [Mocha](http://visionmedia.github.com/mocha/), [Qunit](http://qunitjs.com/).
123
124
125## Revision History
126
127Feb 18-15 - 1.2.2
128PR's merged, but this project is not actively maintained.
129
130May 1-13 - 1.1.4
131Loaded reverting for grunt-blanket, branch tracking reporter fixed, coverage on-the-go (displaying coverage results while a single page is being used).
132
133Apr 28-13 - 1.1.3
134YUI support added with custom adapter (and some wrapping code). CompoundJS support appears to be outside the scope of project.
135
136... (see [full revision history](HISTORY.md))
137
138## License
139Copyright (c) 2012-2013 Alex Seville
140Licensed under the MIT license.