npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

jscov

v0.6.16

Published

JSCoverage, implemented in JavaScript

Downloads

349

Readme

jscov Build Status

JSCoverage, implemented in JavaScript

Installing

npm install -g jscov

Using

Start with jscov --help on the command line and the rest should be obvious.

You can also use it programmatically. It has two functions and can be used like this:

var jscov = require('jscov');

// Transforming source code
//
// Pass in some javascript code as a string and get a new string back,
// containing the same program but with code coverage support added.
//
// A filename has to be passed in as well, since the code coverage bits requires one.

var coveredSource = jscov.rewriteSource("var a = 1 + 2; console.log(a);", "myfilename.js");

// Transforming directories of code (like the command line client)
//
// This is simply the programmatic version of the command line client.
// Pass in a source directory and a target directory and all JavaScript (and CoffeeScript)
// found in source diriectory will be processed using `rewriteSource` and written to the target directory.
jscov.rewriteFolder("src", "src-cov", function(err) {
  // err will indicate if something went wrong.
});

Developing

Pull request are welcome obviously!

Running the tests requires jscoverage to be installed. This is because the main part of the tests compares the output of jscov to jscoverage. Get it here http://siliconforks.com/jscoverage or do what .travis.yml does to get it up and running.

Todo

  • Test using empty blocks in some different contexts. Are they removed?
  • Write a test for testing the actual code-coverage with and without using the expander
  • Attempt to instrument code that has already been instrumented (seems like jscoverage prevents that)
  • Branches current attempting to solve:
    • Float precision
    • Encodings
    • Octal-looking decimals
    • JS v1.6
  • Implement the following features from JSCoverage:
    • encoding
    • exclude
    • js-version
    • no-highlight
    • no-instrument
    • verbose
  • codeExpander should be tested to confirm that the program before and after does the exact same thing (could the AST's be reduced or should test programs be run?)
  • Look into the parse parameters "source" and "tokens"; might be helpful for simplying keeping source code and solivng the octal bug
  • Make jscoverage and jscov run with the same default parameters (for example encoding and js-version)