Script to generate an html report for RequireJS using Mocha to run unit testing. It is going to instrument code, saving a backup of your files, run tests generating LCOV file, exclude libraries directory from report, revert your source code, and generate an HTML report to help developer understand your coverage.
Generate and HTML report from a lcov report file in order to help completing code coverage of javascript code, without changing the way you build your project.
Requirements are:
- NodeJS
- Install modules using packege.json, in this example using Mocha using Sinon + Chai, and Istanbul to instrument code
- LCOV
To generate a complete html summary for Coverage and a lcov.info file with summary just run:
$ ./requirejsCoverage.sh
- Source code has to be located in
src/main/webapp/scripts - Test directory as
src/test/javascript - Libraries to be excluded from report
src/main/webapp/scripts/lib/
Reports are going to be generated in build/requirejs-reports
Source directory as src/main/webapp/scripts and test directory as src/test/javascript and Javascript test files as *Test.js
Here’s how we suggest you go about proposing a change to this project:
- Fork this project to your account.
- Create a branch for the change you intend to make.
- Make your changes to your fork.
- Send a pull request from your fork’s branch to our
masterbranch.
Using the web-based interface to make changes is fine too, and will help you by automatically forking the project and prompting to send a pull request too.
MIT.