[Pkg-javascript-commits] [node-log-driver] 17/49: fixed coerage reporting.

Bastien Roucariès rouca at moszumanska.debian.org
Thu Feb 22 12:57:02 UTC 2018


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

rouca pushed a commit to branch master
in repository node-log-driver.

commit b4915c107bee986cf3defd46832c32d5e16c281a
Author: cainus <gregg at caines.ca>
Date:   Tue Mar 26 13:27:47 2013 -0700

    fixed coerage reporting.
---
 Makefile      |  2 +-
 test/index.js | 16 +++++++++++-----
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index d1e5302..8a76264 100644
--- a/Makefile
+++ b/Makefile
@@ -6,7 +6,7 @@ lib-cov:
 	jscoverage lib lib-cov
 
 test-cov:	lib-cov
-	@LOGDRIVER_COVERAGE=1 $(MAKE) test REPORTER=html-cov > coverage.html
+	@LOGDRIVER_COVERAGE=1 $(MAKE) test REPORTER=html-cov 1> coverage.html
 	rm -rf lib-cov
 
 test-coveralls:	lib-cov
diff --git a/test/index.js b/test/index.js
index 100f150..043fd5a 100644
--- a/test/index.js
+++ b/test/index.js
@@ -1,22 +1,29 @@
 var should = require('should');
-var logger = require('../lib/index');
-var defaultLogger = require('../lib/index').logger;
+var logger = require('../index');
+var defaultLogger = require('../index').logger;
 var sinon = require('sinon-restore');
 var logged = "";
+var oldConsoleLog = console.log;
 
-/* NOTE: conole.log is mocked in these tests, so any uses of it will be
+/* NOTE: console.log is mocked in these tests, so any uses of it will be
  * appended to the variabled "logged".  This will include any calls you
  * make to console.log() for the purpose of debugging in these tests.
+ *
+ * use oldConsoleLog() instead if you need to console.log() for
+ * debugging;
  */
 
 
 describe("logdriver", function(){
   beforeEach(function(){
     logged = "";
-    sinon.stub(console, 'log', function(str){logged += str + "\n";});
+    sinon.stub(console, 'log', function(str){
+      logged += str + "\n";
+    });
   });
   afterEach(function(){
     sinon.restoreAll();
+    console.log = oldConsoleLog;
     logged = "";
   });
   it ("provides a default instance of logger with default levels", function(){
@@ -58,5 +65,4 @@ describe("logdriver", function(){
     mylogger.error("here's an error");
     JSON.parse(logged).should.eql({"0":"error","1":"here's an error"});
   });
-
 });

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-log-driver.git



More information about the Pkg-javascript-commits mailing list