Permalink
Browse files

getCoverage can resolve istanbul coverage data

  • Loading branch information...
1 parent 6d30af5 commit be32c7f290cc3d68e138f0a80d7138449e5f8e31 @davglass davglass committed Sep 26, 2012
Showing with 12 additions and 5 deletions.
  1. +12 −5 javascript/src/core/TestRunner.js
@@ -918,12 +918,19 @@
* format is specified, a string representing the results in that format.
* @method getCoverage
*/
- getCoverage: function(format){
- if (!this._running && typeof _yuitest_coverage == "object"){
- if (typeof format == "function"){
- return format(_yuitest_coverage);
+ getCoverage: function(format) {
+ var covObject = null;
+ if (typeof _yuitest_coverage === "object") {
+ covObject = _yuitest_coverage;
+ }
+ if (typeof __coverage__ === "object") {
+ covObject = __coverage__;
+ }
+ if (!this._running && typeof covObject == "object"){
+ if (typeof format == "function") {
+ return format(covObject);
} else {
- return _yuitest_coverage;
+ return covObject;
}
} else {
return null;

0 comments on commit be32c7f

Please sign in to comment.