Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

blanket

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

blanket

simple js code coverage

  • 0.9.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
15K
increased by77.23%
Maintainers
1
Weekly downloads
 
Created
Source

Blanket.js

A seamless JavaScript code coverage library.

Project home page

Philosophy

Blanket.js is a code coverage tool for javascript that aims to be:

  1. Easy to install
  2. Easy to use
  3. Easy to understand

Blanket.js can be run seamlessly or can be customized for your needs.

Mechanism

JavaScript code coverage compliments your existing JavaScript tests by adding code coverage statistics (which lines of your source code are covered by your tests).

Blanket works in a 3 step process:

  1. Loading your source files using a modified RequireJS/Require script
  2. Parsing the code using Esprima and node-falafel, and instrumenting the file by adding code tracking lines.
  3. Connecting to hooks in the test runner to output the coverage details after the tests have completed.

Install

Download the appropriate version of blanket.js for your test runner:
QUnit: blanket.js for QUnit
Mocha: npm install blanket

Or build it yourself.

Reference the script in your test runner.
QUnit: <script src="blanket.js"></script>
Mocha: require("blanket")(<pattern-for-source-files>); The argument passed is a string (or regex) that refers to the folder where the source scripts are stored.
Note: This require statement must be placed before the require statement of any scripts that you want covered.

Configure

QUnit: Add the data attribute data-cover to any script file you want covered.
(Ex: <script src="mylibrary.js data-cover></script> )
Mocha: No additional configuration required.

Use

QUnit: Run the tests (with the 'Enable Coverage' box checked) and you'll see the coverage statistics appended below the test results. Mocha: Use the built-in reporters to output coverage details, i.e. mocha -R html-cov > coverage.html

Continuous Integration

To integrate Blanket.js with an instance of Travis CI:

  1. npm install travis-cov
  2. Add to your package.json,
          "test": "mocha ./node_modules/.bin/mocha -R travis-cov"  
        },
        "travis-cov-threshold": <number>```   
    
  3. When you commit your code to Travis the coverage results will be compared against the threshold and will fail if any files fall below the threshold.

Roll your own

  1. git clone git@github.com:Migrii/blanket.git
  2. cd /blanket/lib
  3. node builder.js <runner> where runner is qunit for browser based, and mocha for node based (for the moment).
  4. Your newly rolled file can be found at /dist/mocha/blanket.js or /dist/qunit/blanket.js

Minification is built into the build script but is disabled for the time being.
We plan on adding a variety of different command line options to allow you to create a version of blanket customized for your needs.
Let us know what you'd like to see!

FAQ

See the FAQ in the Blanket Wiki.

Disclaimer

This product is currently in beta release and is NOT stable or production ready. It is subject to changes. We appreciate any feedback or assistance.

Documentation

(Coming soon)

Revision History

Nov-8-12 - 0.9.2 Bug fixes to instrumentation and node require loader.

Nov-4-12 - 0.9.1 Works seamlessly with mocha (in node) and uses built in mocha reporters for coverage.

Oct-29-12 - 0.9.0 Initial release of blanket.js. Works with qunit, but coverage output is not complete.

License

Copyright (c) 2012 Alex-Seville
Licensed under the MIT license.

Keywords

FAQs

Package last updated on 18 Nov 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc