neonux/CoverMonkey
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Repository files navigation
CoverMonkey is a code-coverage tool for the SpiderMonkey JavaScript interpreter from Mozilla. Using it requires a recent debug build of SpiderMonkey. To obtain a debug build, follow the "Advanced Build" directions here: https://developer.mozilla.org/En/SpiderMonkey/Build_Documentation . For correct dead-code analysis, CoverMonkey requires a patch that just went into the SpiderMonkey source tree (2011-08-22), so make sure you have a recent snapshot of the source. To build CoverMonkey, type: make This just assembles a CoverMonkey node script from the files in src/ To use CoverMonkey, run your code in SpiderMonkey with the -D option set, and pipe the output (-D generates a *lot* of output) to CoverMonkey. For example: js -D -f my_library.js -f my_tests.js | CoverMonkey -b CoverMonkey uses node, so you'll need to get that from http://nodejs.org if you don't already have it. I've used the util.format() function that is new in Node 0.5, so you'll need a recent version of node. Usage: CoverMonkey [options] CoverMonkey reads the output generated by SpiderMonkey's -D option (supported by debug builds of SpiderMonkey only) and analyzes it to detect dead code and report code coverage. CoverMonkey reads -D data from stdin by default. Use the -d option to make it read from a file instead. CoverMonkey writes basic code coverage statistics to stdout. Use -q, -p, -c and -l to modify the information displayed. CoverMonkey can generate an HTML file that annotates and colors your source code to highlight uncovered and dead code and indicate how many times each line executed. Use the -h, -a, and -b options to control HTML generation. By default, CoverMonkey will output coverage information for all source files that were run. Use one or more -t options to specify which files CoverMonkey should analyze. Options: -d <file> Read -D data from the specified file instead of stdin -t <file> Analyze coverage for the specified target file. Multiple -t options are allowed. -q Quiet: don't display any output to stdout -p Percent: only display coverage percentage -c Display the coverage statistics in compact tabular form -l List the line numbers of all uncovered lines -h <file> Output annotated source code, in HTML format, to the specified file. -a Include assembly code for each line in the HTML file. This may be useful for understanding partially-covered lines. -b Automatically launch a browser window to display the HTML. If no -h option, writes HTML to a temporary file. This option may only work on MacOS. --atlines Honor //@line comments in the source This option is probably not generally useful -v Display the CoverMonkey version number and exit --help Display this message and exit