JSCoverage - code coverage for JavaScript

# JSCoverage
code coverage for JavaScript

JSCoverage is a tool that measures code coverage for JavaScript programs.

Code coverage statistics show which lines of a program have been executed (and which have been missed). This information is useful for constructing comprehensive test suites (hence, it is often called test coverage).

JSCoverage works by instrumenting the JavaScript code used in web pages. Code coverage statistics are collected while the instrumented JavaScript code is executed in a web browser.

JSCoverage supports the complete language syntax described in the ECMAScript Language Specification (ECMA-262, 3rd edition). JSCoverage works with any modern standards-compliant web browser - including Internet Explorer (IE 6, 7, and 8), Firefox, Opera, Safari, and Google Chrome - on Microsoft Windows and GNU/Linux.

JSCoverage is free software, distributed under the GNU General Public License version 2.

## Latest News

### September 23, 2010 - JSCoverage 0.5.1

JSCoverage 0.5.1 is available for download.

This release contains several bug fixes and improvements:

- Probably the largest change is in the documentation: the manual no longer recommends using `file:` URLs. It is recommended that an HTTP server be used instead. (See the manual for details.) The JSCoverage user interface now displays a warning when used with `file:` URLs.
- The `--verbose` option to `jscoverage` now produces better output.
- Report loading is now faster (thanks to Klaus).
- Some bugs involving augmented object prototypes were fixed.
- JavaScript instrumentation was improved to work better in non-browser environments.
- Some cases where permission errors were occurring in inverted mode were fixed (thanks to tn).
- Previously, if `jscoverage-server` was started with the option `--ip-address=A`, where A was a specific IP address, it was impossible to shut it down with `jscoverage-server --shutdown`. This should be possible now by running `jscoverage-server --shutdown --ip-address=A` from the same machine.
- The test suite has been made more robust.

### April 26, 2010 - New blog

If you would like to see some case studies showing how to use JSCoverage in practice, take a look at the new blog. This week there will be a series of articles about using JSCoverage with various JavaScript testing frameworks. The first article looks at using JSCoverage with the script.aculo.us test suite.

### April 24, 2010 - JSCoverage 0.5

JSCoverage 0.5 is available for download.

This release contains a number of new features and bug fixes:

- A new mode of operation, called "window mode", allows you to run code in a new browser window (or tab).
- Code coverage statistics can now be generated for applications based on the Mozilla platform using the `--mozilla` option (thanks to Murali Nandigama for help creating this).
- The method used to calculate overall percentage code coverage for all files has changed. Previously, the calculation was done using an unweighted average: each file's percentage code coverage contributed equally to the total, regardless of the number of lines of code in the file. Now, the calculation is done using a weighted average. This fixes bug #6 (thanks to Liu Cougar).
- Contiguous lines in the "Missing" column are now grouped together (thanks to Liu Cougar).
- The "Source" tab is no longer empty when code being tested throws an uncaught exception (fixing bug #5)
- Previously, certain uses of the `new` operator were instrumented incorrectly; this has now been fixed (thanks to Guillaume Lung).
- The `jscoverage-server` program now allows more characters in URLs (thanks to Guillaume Lung).
- The `jscoverage-server` program now handles HTTP headers with empty values (thanks to Velo).
- The `jscoverage` program now refuses to instrument code which has already been instrumented (thanks to Velo).
- URLs containing spaces now work correctly (thanks to Igor Papkov).
- Previously, on Windows, the `jscoverage` program was unable to instrument a directory in a drive root; this has now been fixed.
- Encoded URLs are now handled better in the query string.
- A limitation of 65,535 lines per file and 65,535 characters per line has been removed.
- Floating-point numbers are now handled with improved precision.
- The `jscoverage-server` program can no longer bind to the same port multiple times on Windows.
- Some bugs in `jscoverage-server`'s handling of the "chunked" Transfer-Encoding have been fixed.
- Compilation under Cygwin now uses the `-mno-cygwin` flag.
- The wire format used for submitting coverage reports for storage by `jscoverage-server` has changed. (This change will not have any visible effects for most users; it will only be of interest to those who have written code which parses that format.)

All news items...