Add support for analyzing test coverage with Istanbul

To use, make sure your Node installation is up to date and install
istanbul with npm:

  sudo npm install -g istanbul      # 'sudo' may be optional on OSX

Then run

  tools/test-js-with-node cover

and navigate to coverage/lcov-report/js/index.html in a browser.

(imported from commit 2da4894d1725e2f9540b3895304246e3cd138f6c)
This commit is contained in:
Scott Feeney 2013-08-20 00:20:02 -04:00
parent 69efe2a695
commit 5f2517bddc
2 changed files with 9 additions and 2 deletions

1
.gitignore vendored
View File

@ -16,3 +16,4 @@ zerver/fixtures/test_data1.json
.kdev4
humbug.kdev4
memcached_prefix
coverage/

View File

@ -4,7 +4,13 @@ cd "$(dirname "$0")"/..
export NODE_PATH=static
# Run the index.js test runner, which runs all the other tests.
INDEX_JS=zerver/tests/frontend/node/index.js
NODEJS=$(which nodejs || which node)
$NODEJS $INDEX_JS
if [ f$1 = fcover ]; then
# Run a coverage test with Istanbul.
istanbul cover $INDEX_JS
else
# Normal testing, no coverage analysis.
# Run the index.js test runner, which runs all the other tests.
$NODEJS $INDEX_JS
fi