Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/benfoxall/jscov
Browser based js coverage tool
https://github.com/benfoxall/jscov
Last synced: 16 days ago
JSON representation
Browser based js coverage tool
- Host: GitHub
- URL: https://github.com/benfoxall/jscov
- Owner: benfoxall
- Created: 2011-12-28T20:52:26.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2011-12-30T11:40:26.000Z (about 13 years ago)
- Last Synced: 2025-01-19T08:31:11.943Z (23 days ago)
- Language: JavaScript
- Homepage:
- Size: 121 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
## A tool for displaying code coverage of js files in the browser
Note. The current implementation is more 'proof of concept' and - ironically - totally untested.
The general idea is to convert the js into a format that will track which lines are executed (like [JSCoverage](http://siliconforks.com/jscoverage/)) - though instead of doing this server side, this script does the conversion in the browser on page load.
### usage
Include your js files with the type of 'text/x-cov-javascript' and then include jscov.js.
This will request 'yourcode.js' via xhr, add markers to the code and re-insert it into a new script tag.
Including this file also gives access to a hacky ui for displaying the files and their coverage, once you've tested your code, call `_$jscov.report();` to display list the js files and their code coverage
### current limitations
* This currently won't work through `file:` protocol.
* The instrumentation (adding markers) is massively basic, it might miss sections or even break stuff.
* document.scripts won't work in FF < 9.[![Alt text](http://s3.bfoxall.com/jscov/screenshot.png)](http://s3.bfoxall.com/jscov/example/example.html)