[Pkg-javascript-commits] [node-mocha-lcov-reporter] 01/06: New upstream version 1.3.0

Julien Puydt julien.puydt at laposte.net
Wed Mar 1 21:00:44 UTC 2017


This is an automated email from the git hooks/post-receive script.

jpuydt-guest pushed a commit to branch master
in repository node-mocha-lcov-reporter.

commit 16b2fc854b9540f55143c70b545525a50a432f00
Author: Julien Puydt <julien.puydt at laposte.net>
Date:   Wed Mar 1 21:52:56 2017 +0100

    New upstream version 1.3.0
---
 CHANGELOG.md | 35 +++++++++++++++++++++++++++++++++++
 lib/lcov.js  | 44 ++++++++++++++++++++++++++++----------------
 package.json |  2 +-
 3 files changed, 64 insertions(+), 17 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..77d53e7
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,35 @@
+## 1.3.0 (Feb 21 2017)
+
+Changes:
+
+- Make writing to output monkey-patchable. (#16)
+
+## 1.2.0 (Feb 21 2016)
+
+Changes:
+
+- Report when no coverage data was found. (#12)
+
+## 1.1.0 (Feb 17 2016)
+
+Changes:
+
+- Add support for Blanket.js. (#13)
+
+## 1.0.0 (Sep 22 2015)
+
+Changes:
+
+- Releasing 1.0.0 (#11)
+- Update license attribute in package.json. (#9)
+
+## 0.0.2 (Feb 26 2015)
+
+Changes:
+
+- Check for window._$jscoverage (Dan Vanderkam)
+- Add more instructions to README
+
+## 0.0.1 (Jul 03 2012)
+
+Initial release
diff --git a/lib/lcov.js b/lib/lcov.js
index bdce101..848902a 100644
--- a/lib/lcov.js
+++ b/lib/lcov.js
@@ -15,33 +15,45 @@ exports = module.exports = LCov;
  */
 
 function LCov(runner) {
-  runner.on('end', function(){
-    // In a browser context, coverage will be in window.$jscoverage or window._$blanket.
-    var g = typeof(global) != 'undefined' ? global : window;
-    var cov = g._$jscoverage || g._$blanket;
-    if (!cov) {
-        console.error('mocha-lcov-reporter: No coverage data found, make sure your code is properly instrumented');
-        return;
-    }
+  var self = this;
 
-    for (var filename in cov) {
-      var data = cov[filename];
-      reportFile(filename, data);
-    }
+  runner.on('end', function() {
+      self.onEnd();
   });
 }
 
-function reportFile(filename, data) {
-  process.stdout.write('SF:' + filename + '\n');
+LCov.prototype.onEnd = function() {
+  // In a browser context, coverage will be in window.$jscoverage or window._$blanket.
+  var g = typeof(global) != 'undefined' ? global : window;
+  var cov = g._$jscoverage || g._$blanket;
+  if (!cov) {
+    console.error('mocha-lcov-reporter: No coverage data found, make sure your code is properly instrumented');
+    return;
+  }
+
+  for (var filename in cov) {
+    var data = cov[filename];
+    this.reportFile(filename, data);
+  }
+}
+
+LCov.prototype.reportFile = function(filename, data) {
+  var self = this;
+
+  self.write('SF:' + filename + '\n');
 
   data.source.forEach(function(line, num) {
     // increase the line number, as JS arrays are zero-based
     num++;
 
     if (data[num] !== undefined) {
-      process.stdout.write('DA:' + num + ',' + data[num] + '\n');
+      self.write('DA:' + num + ',' + data[num] + '\n');
     }
   });
 
-  process.stdout.write('end_of_record\n');
+  self.write('end_of_record\n');
+}
+
+LCov.prototype.write = function(string) {
+    process.stdout.write(string);
 }
diff --git a/package.json b/package.json
index eee7875..f995bbe 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
 {
     "name": "mocha-lcov-reporter",
     "description": "LCOV reporter for Mocha",
-    "version": "1.2.0",
+    "version": "1.3.0",
     "author": "Steven Looman <steven.looman at gmail.com>",
     "keywords": [ "mocha", "reporter", "lcov", "coverage" ],
     "license": "BSD-2-Clause",

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-mocha-lcov-reporter.git



More information about the Pkg-javascript-commits mailing list