node package manager
Loosely couple your services. Use Orgs to version and reuse your code. Create a free org »

covjson-reader

covjson-reader

NPM version dependencies Status devDependencies Status Build Status

A library that reads CoverageJSON documents and exposes them as Coverage data objects.

API docs

Usage

A browser version of this library is hosted on both jsDelivr and cdnjs, where the latter also hosts the unminified version together with source maps.

Usage is simple:

<script src="https://unpkg.com/covutils/covutils-lite.min.js"></script>
<script src="https://cdn.jsdelivr.net/covjson-reader/0.16/covjson-reader.min.js"></script>
<script>
CovJSON.read('http://example.com/coverage.covjson').then(function (cov) {
  // work with Coverage object 
}).catch(function (e) {
  // there was an error when loading the coverage 
  console.log(e)
})
</script> 

The library makes use of the following ES2015 features: Promise, Symbol, Map, and Array.from. Depending on which browsers you need to support it may be necessary to include polyfills before loading this library.

NPM

This library can be used with browserify and similar tools by importing it via npm.

ES2015 syntax:

import * as CovJSON from 'covjson-reader'
 
CovJSON.read('http://example.com/coverage.covjson').then(cov => {
  // work with Coverage object 
}).catch(e => {
  // there was an error when loading the coverage 
  console.log(e)
})

Acknowledgments

This library is developed within the MELODIES project.