Closure Library style test and coverage
Clipcover is packaged as a Node module, and is available via:
npm install clipcover
Or if you prefer the source:
git clone https://github.com/gumm/clipcover.git
Once downloaded, you can get the required dependant packages via:
This will install PhantomJS as a node module.
Clipcover requires on JSCoverage to be installed by hand. For instructions please visit their download page.
Once installed, you can test it with:
jscoverage-server 0.5.1Character encoding support: iconvCopyright 2010 siliconforks.comLicense GPLv2+: GNU GPL version 2 or laterThis is free software: you are free to change and redistribute it.There is NO WARRANTY, to the extent permitted by law.
PhantomJs is automatically installed and available via the npm wrapper phantomjs
Clipcover is intended to be run from the command line. When run, it:
This means there is a bit of setup to be done. The easiest way was to pass Clipcover a single working directory as an entry point. This will be used as the root of the web server as well, and all files that you want to test, should be available below this point.
From this entry point two command line flags control the input. Both these paths are relative to the given workspace. Supported command-line options are:
-fA relative path the HTML test entry point. [/media/js/tests/all_tests.html]
-iA relative path to a directory to be excluded from coverage reports. [/media/js/closure-library/]
Clipcover also needs to know where you want the reports written to. This path is not relative, and can be anywhere on the filesystem. Coverage reports in HTML format will be written to this directory. The TAP output file will also be located here. Below are examples of the CLI relevant CLI flags:
-rAn absolute system path to a directory where the reports will be written. [/tmp/reports/output/]
-oA name of the TAP report file. Will be written to the directory specified by
The server that Clipcover starts needs an IP address and port number. The following flags are used to specify those:
-sThis is the number part of the address only [0.0.0.0]
-pThe number of the port on which the server will run  Taken together, these flags (or rather the defaults of these flags) produce a server that is accessable by pointing your browser to http://0.0.0.0:8080/
For a bit of housekeeping, Clipcover can be given a limited time to run in. This is the maximum time that both the PhantomJS browser and the JSCover server will be kept alive.
-tIs the maximum time - in milliseconds - that the servie will be kept alive.  (10min)
-hGives remiders of the available CLI flags
-h, --help output usage information-V, --version output the version number-f, --test-file <path> relative path from workspace to test file [/media/js/trin/tests/all_tests.html]-i, --ignore-dir <path> relative path from workspace, nothing here will be instrumented [/media/js/closure-library/]-t, --timeout <milliseconds> maximum time phantomjs will be kept alive -s, --server-ip-address <address> coverage server ip address [0.0.0.0]-p, --server-port <port> coverage server port -r, --report-dir <path> absolute path to dir where reports will be written [/tmp/reports/]-o, --output-file <path> name of test result output file to be written in report dir [result.txt]