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

grunt-qunit-istanbul-fixed

v0.4.1

Published

Run QUnit unit tests in a headless PhantomJS instance and create coverage reports with istanbul.

Downloads

6

Readme

grunt-qunit-istanbul

Run QUnit unit tests in a headless PhantomJS instance with code coverage analysis provided by istanbul.

IMPORTANT

This is a fork of the grunt-contrib-qunit repo, adding the ability to generate istanbul test coverage reports. Unfortunately this cannot be handled as a seperate plugin, because it needs to hook into the grunt-contrib-qunit and grunt-lib-phantomjs structure.

This plugin should work as a drop-in replacement for your current qunit task. For any further configuration, please check out the original plugin's repo.

Getting Started

This plugin requires Grunt ~0.4.0.

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile, as well as how to install and use Grunt plugins. Once you're familiar with that process, you can install this plugin with this command:

npm install grunt-qunit-istanbul --save-dev

Once the plugin has been installed, it can be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-qunit-istanbul');

QUnit task

Run this task with the grunt qunit command.

Task targets, files and options may be specified according to the grunt Configuring tasks guide.

When installed by npm, this plugin will automatically download and install PhantomJS locally via the grunt-lib-phantomjs-istanbul library.

Also note that running grunt with the --debug flag will output a lot of PhantomJS-specific debugging information. This can be very helpful in seeing what actual URIs are being requested and received by PhantomJS.

OS Dependencies

This plugin uses PhantomJS to run tests. PhantomJS requires the following dependencies:

On Ubuntu/Debian

apt-get install libfontconfig1 fontconfig libfontconfig1-dev libfreetype6-dev

On CentOS

yum install fontconfig freetype

Options (Coverage object)

src

  • Type: array
  • Default: []

The js files you would like to end up in the coverage report.

instrumentedFiles

  • Type: string

A temporary folder (that will be automatically generated and deleted after the test suite finishes) containing the instrumented source code.

htmlReport

  • Type: string [optional]

A folder where the HTML reports should be stored.

coberturaReport

  • Type: string [optional]

A folder where the Cobertura reports should be stored.

lcovReport

  • Type: string [optional]

A folder where the LCOV reports should be stored.

cloverReport

  • Type: string [optional]

A folder where the Clover reports should be stored.

baseUrl

  • Type: string [optional]
  • Default: .

If you're running your qunit tests with the help of a webserver, you have to point the coverage inspector to the physical path that is the base url of the qunit page you're running.

linesThresholdPct

  • Type: number [optional]

Lines coverage percentage threshold to evaluate when running the build. If the actual coverage percentage is less than this value, the build will fail.

statementsThresholdPct

  • Type: number [optional]

Statements coverage percentage threshold to evaluate when running the build. If the actual coverage percentage is less than this value, the build will fail.

functionsThresholdPct

  • Type: number [optional]

Functions coverage percentage threshold to evaluate when running the build. If the actual coverage percentage is less than this value, the build will fail.

branchesThresholdPct

  • Type: number [optional]

Branches coverage percentage threshold to evaluate when running the build. If the actual coverage percentage is less than this value, the build will fail.

disposeCollector

  • Type: boolean [optional]
  • Default: false

Whether or not to dispose the previous collector and create a new instance of it, discarding the info of previously instrumented files. This is useful if using grunt-qunit-istanbul as a multi task with separate targets generating separate coverage reports. If set to true for a particular target, the plugin will generate a coverage report only for the files specified in the coverage.src property, even when files used by the current target were also instrumented by a previous target. See the related bug report.

Usage

qunit: {
  options: {
    '--web-security': 'no',
    coverage: {
      disposeCollector: true,
      src: ['src/js/**/*.js'],
      instrumentedFiles: 'temp/',
      htmlReport: 'report/coverage',
      coberturaReport: 'report/',
      linesThresholdPct: 85
    }
  },
  all: ['test/**/*.html']
}

Original Task by "Cowboy" Ben Alman

Modified by asciidisco