Skip to content

Instantly share code, notes, and snippets.

@rpl
Last active September 7, 2017 14:28
Show Gist options
  • Save rpl/a78d2450c092705f486cf1428183ad6b to your computer and use it in GitHub Desktop.
Save rpl/a78d2450c092705f486cf1428183ad6b to your computer and use it in GitHub Desktop.
Locally generate JS coverage reports from Firefox tests

Generate JSCOV reports from mochitest and xpcshell tests locally

  • create the directory where the lcov files will be stored
 mkdir /tmp/JSCOV 
  • generate the lcov files:
 JS_CODE_COVERAGE_OUTPUT_DIR=/tmp/JSCOV ./mach test PATH/TO/TEST/FILE ...
  • generate chrome-map.json (needed by lcov_rewriter)
 ./mach build-backend -b ChromeMap   
  • rewrite urls in the generated lcov reports (rewrites chrome and resource urls to path to files)
 ./mach python python/mozbuild/mozbuild/codecoverage/lcov_rewriter.py /tmp/JSCOV/*.info
  • generate HTML report from the rewritten lcov reports (using genhtml binary from the lcov tools)
genhtml /tmp/JSCOV/*.info.out -o /tmp/JSCOV-HTML/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment