istanbul-traceur
Istanbul is a robust code coverage tool, could be run on both Node.js and browsers, provides many report formats (HTML, LCOV, etc.) to have testing and continuous integration done right. But Istanbul could not understand JavaScript of the future (e.g. ECMCScript 6). The next JavaScript provides new language features which help development process goes faster and produces less bugs.
Fortunately, we have Traceur, which is a transpiler (source-to-source compiler) which could convert JavaScript of the future to current JavaScript.
This module is here to help connecting these two awesome thing together. It stands as an alternative to Istanbul, enables you to use Traceur to write applications in modern JavaScript without worrying about code coverage.
Installation
This module can be installed easily with npm:
$ npm install istanbul-traceur
Usage
Directly
main.js:
var fs = ; var istanbul = ;var instrumenter = ; var content = fs;var code = instrumenter; ;//=> prints "You have done right!"
es6.js:
; var { return !!n & 1;}; ;; console;
Gulp
Withgulpfile.js:
var gulp = ;var istanbul = ;var mocha = ; var istanbulTraceur = ; gulp;
gulp test
in Terminal:
HTML report:
Grunt
WithGruntfile.js:
var istanbulTraceur = ; module { grunt; grunt; grunt; var usedIstanbul; var Instrumenter; grunt; grunt; grunt;};
When using with Grunt:
NOTE: Because instrumented copies of your source files lie in different directory, you have to make sure all
require
methods in your test files pointing to correct source file's locations.
grunt test
in Terminal:
HTML report is also available when using with Grunt.
Command-line usage
This feature is not available at the moment and will be implemented soon. If you want to give a hand, create a pull request.
Compatibility
- This module has been tested to run properly with Traceur version 0.0.61 (latest version at the time of writing). It could be broken in the future if Traceur introduces non backward-compatible changes. In that circumstance, feel free to create new issue or create a pull request.
Contributing
Before create a pull request, make sure that you:
-
Followed coding convention as described in .editorconfig or .jshintrc file (more information can be found at editorconfig.org and www.jshint.com/docs, respectively).
-
Added tests for your code.
-
Passed all tests!
To execute all tests, simply run:
$ npm test
Contributors
- Author: Meo
License
This module is released under MIT license.