[Pkg-javascript-commits] [node-log-driver] 27/49: switched to istanbul for coverage. stop build from failing just because coveralls.io does.

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 9bdfb354e03a9b98d7b17bdf992920b82e66dddb
Author: Gregg Caines <gregg at caines.ca>
Date:   Sat Mar 29 20:47:14 2014 -0700

    switched to istanbul for coverage.  stop build from failing just because coveralls.io does.
---
 .gitignore   |  1 +
 Makefile     | 19 +++++++++-------
 index.js     | 63 +++++++++++++++++++++++++++++++++++++++++++++++-----
 lib/index.js | 60 --------------------------------------------------
 package.json | 72 ++++++++++++++++++++++++++++++++----------------------------
 5 files changed, 108 insertions(+), 107 deletions(-)

diff --git a/.gitignore b/.gitignore
index e4079fc..63e30ca 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@ node_modules
 npm-debug.log
 lib-cov
 coverage.html
+coverage
diff --git a/Makefile b/Makefile
index 8a76264..f437884 100644
--- a/Makefile
+++ b/Makefile
@@ -2,16 +2,19 @@ REPORTER = spec
 test:
 	@NODE_ENV=test ./node_modules/.bin/mocha -b --reporter $(REPORTER)
 
-lib-cov:
-	jscoverage lib lib-cov
+lint:
+	./node_modules/.bin/jshint ./test ./index.js
 
-test-cov:	lib-cov
-	@LOGDRIVER_COVERAGE=1 $(MAKE) test REPORTER=html-cov 1> coverage.html
-	rm -rf lib-cov
+test-cov:
+	$(MAKE) lint
+	@NODE_ENV=test ./node_modules/.bin/istanbul cover \
+	./node_modules/mocha/bin/_mocha -- -R spec
 
-test-coveralls:	lib-cov
+test-coveralls:
 	echo TRAVIS_JOB_ID $(TRAVIS_JOB_ID)
-	@LOGDRIVER_COVERAGE=1 $(MAKE) test REPORTER=json-cov 2> /dev/null | ./node_modules/coveralls/bin/coveralls.js
-	rm -rf lib-cov
+	$(MAKE) test
+	@NODE_ENV=test ./node_modules/.bin/istanbul cover \
+	./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && \
+		cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js || true
 
 .PHONY: test
diff --git a/index.js b/index.js
index 39c829d..a78776f 100644
--- a/index.js
+++ b/index.js
@@ -1,7 +1,60 @@
-var dir = './lib/';
-if (process.env.LOGDRIVER_COVERAGE){
-  dir = './lib-cov/';
-}
+var util = require('util');
 
-module.exports = require(dir + 'index');
+LogDriver = function(options){
+  options = options || {};
+  var logger = this;
+  if (options.format){
+    this.format = options.format;
+  }
+  this.levels = options.levels || ['error', 'warn', 'info', 'debug', 'trace'];
+  if (options.level === false){
+    this.level = false;  // don't log anything
+  } else {
+    this.level = options.level || this.levels[this.levels.length - 1];
+    if (this.levels.indexOf(this.level) === -1){
+      throw new Error("Log level '" +
+                      this.level +
+                      "' does not exist in level list '" + JSON.stringify() + "'");
+    }
+  }
+  this.levels.forEach(function(level){
+    if (logLevelShouldOutput(level, logger.level, logger.levels)){
+      logger[level] = function(){
+        var args = Array.prototype.slice.call(arguments);
+        args.unshift(level);  // log level is added as the first parameter
+        console.log(logger.format.apply(logger, args));
+      };
+    } else {
+      logger[level] = function(){/* no-op, because this log level is ignored */};
+    }
+  });
+};
 
+var logLevelShouldOutput = function(logLevel, configuredLevel, levels){
+  if (configuredLevel === false){
+    return false;
+  }
+  return (levels.indexOf(logLevel) <= levels.indexOf(configuredLevel));
+};
+
+LogDriver.prototype.format = function(){
+  var args = Array.prototype.slice.call(arguments, [1]); // change arguments to an array, but
+                                                         // drop the first item (log level)
+  var out = "[" + arguments[0] + "] " + JSON.stringify(new Date()) + " ";
+  args.forEach(function(arg){
+    out += " " + util.inspect(arg);
+  });
+  return out;
+};
+
+var defaultLogger = null;
+
+factory = function(options){
+  defaultLogger = new LogDriver(options);
+  factory.logger = defaultLogger;
+  return defaultLogger;
+};
+
+factory();
+
+module.exports = factory;
diff --git a/lib/index.js b/lib/index.js
deleted file mode 100644
index a78776f..0000000
--- a/lib/index.js
+++ /dev/null
@@ -1,60 +0,0 @@
-var util = require('util');
-
-LogDriver = function(options){
-  options = options || {};
-  var logger = this;
-  if (options.format){
-    this.format = options.format;
-  }
-  this.levels = options.levels || ['error', 'warn', 'info', 'debug', 'trace'];
-  if (options.level === false){
-    this.level = false;  // don't log anything
-  } else {
-    this.level = options.level || this.levels[this.levels.length - 1];
-    if (this.levels.indexOf(this.level) === -1){
-      throw new Error("Log level '" +
-                      this.level +
-                      "' does not exist in level list '" + JSON.stringify() + "'");
-    }
-  }
-  this.levels.forEach(function(level){
-    if (logLevelShouldOutput(level, logger.level, logger.levels)){
-      logger[level] = function(){
-        var args = Array.prototype.slice.call(arguments);
-        args.unshift(level);  // log level is added as the first parameter
-        console.log(logger.format.apply(logger, args));
-      };
-    } else {
-      logger[level] = function(){/* no-op, because this log level is ignored */};
-    }
-  });
-};
-
-var logLevelShouldOutput = function(logLevel, configuredLevel, levels){
-  if (configuredLevel === false){
-    return false;
-  }
-  return (levels.indexOf(logLevel) <= levels.indexOf(configuredLevel));
-};
-
-LogDriver.prototype.format = function(){
-  var args = Array.prototype.slice.call(arguments, [1]); // change arguments to an array, but
-                                                         // drop the first item (log level)
-  var out = "[" + arguments[0] + "] " + JSON.stringify(new Date()) + " ";
-  args.forEach(function(arg){
-    out += " " + util.inspect(arg);
-  });
-  return out;
-};
-
-var defaultLogger = null;
-
-factory = function(options){
-  defaultLogger = new LogDriver(options);
-  factory.logger = defaultLogger;
-  return defaultLogger;
-};
-
-factory();
-
-module.exports = factory;
diff --git a/package.json b/package.json
index 981a8ab..d92aca7 100644
--- a/package.json
+++ b/package.json
@@ -1,36 +1,40 @@
 {
-      "name": "log-driver",
-      "description" : "log-driver is a simple logging framework for logging to stdout",
-      "keywords" : ["logging", "logger", "log"],
-      "version": "1.2.2",
-      "bugs": {
-       "url": "https://github.com/cainus/logdriver/issues"
-      },
-      "repository" : {
-          "type": "git", 
-            "url": "git://github.com/cainus/logdriver.git"
-      },
-      "scripts" : {
-        "test" : "make test-coveralls"
-      },
-      "maintainers": [
-        {
-          "name": "Gregg Caines",
-          "email": "gregg at caines.ca",
-          "web": "http://caines.ca"
-        } 
-      ],
-      "dependencies": {
-      },
-      "devDependencies" : {
-          "jscoverage" : "0.3.6",
-          "sinon-restore" : "1.0.0",
-          "coveralls": "1.1.0",
-          "mocha" : "1.8.1",
-          "should" : "1.1.0"
-      },
-      "engines" : {
-                   "node" : ">=0.8.6",
-                   "npm" : "1.1.65"
-                  }
+  "name": "log-driver",
+  "description": "log-driver is a simple logging framework for logging to stdout",
+  "keywords": [
+    "logging",
+    "logger",
+    "log"
+  ],
+  "version": "1.2.3",
+  "bugs": {
+    "url": "https://github.com/cainus/logdriver/issues"
+  },
+  "repository": {
+    "type": "git",
+    "url": "git://github.com/cainus/logdriver.git"
+  },
+  "scripts": {
+    "test": "make test-coveralls"
+  },
+  "maintainers": [
+    {
+      "name": "Gregg Caines",
+      "email": "gregg at caines.ca",
+      "web": "http://caines.ca"
+    }
+  ],
+  "dependencies": {
+  },
+  "devDependencies": {
+    "jshint": "2.4.4",
+    "istanbul": "0.2.6",
+    "coveralls": "2.10.0",
+    "sinon-restore": "1.0.0",
+    "mocha": "1.8.1",
+    "should": "1.1.0"
+  },
+  "engines": {
+    "node": ">=0.8.6"
+  }
 }

-- 
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