From 6fd2f3ad153aab9263ebe899fd6575a9a2b66909 Mon Sep 17 00:00:00 2001 From: FG Ribreau Date: Tue, 23 Aug 2016 16:46:38 +0200 Subject: [PATCH] fix(tests): fix coverage to 100% --- package.json | 2 +- src/withLogger.js | 1 - src/withLogger.test.js | 7 ++++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index c86c727..00b8843 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "test": "npm run test-unit && npm run test-coverage", "test-unit": "mocha $(find src -name '*.test.js')", "test-watch": "mocha -R min -w $(find src -name '*.test.js')", - "test-coverage": "nyc --all --statements=100 --lines=100 --functions=90 --branches=70 --check-coverage --reporter=lcov --reporter=cobertura --report-dir=coverage -- mocha -R spec -t 100000 $(find src -name '*.test.js')", + "test-coverage": "nyc --all --statements=100 --lines=100 --functions=100 --branches=100 --check-coverage --reporter=lcov --reporter=cobertura --report-dir=coverage -- mocha -R spec -t 100000 $(find src -name '*.test.js')", "send-coverage": "cat ./coverage/lcov.info | coveralls", "check-build": "check-build", "update": "updtr", diff --git a/src/withLogger.js b/src/withLogger.js index f9777c3..023c181 100644 --- a/src/withLogger.js +++ b/src/withLogger.js @@ -3,7 +3,6 @@ var envFactory = require('..'); module.exports = function (logger) { - logger = logger || console; var env = envFactory(); env.on(env.EVENT_FOUND, function (fullKeyName, value, $secure) { diff --git a/src/withLogger.test.js b/src/withLogger.test.js index 9a2e023..0f9af7c 100644 --- a/src/withLogger.test.js +++ b/src/withLogger.test.js @@ -32,13 +32,18 @@ describe('withLogger', function() { password: { $default: 'iAmUseless', $secure: true + }, + password2: { + $default: 'iAmUseless', + $secure: true } }); t.strictEqual(config.username, process.env.USERNAME); t.strictEqual(config.password, process.env.PASSWORD); t.deepEqual(logger.calls, [ ["[env] %s was defined, using: %s", "USERNAME", process.env.USERNAME], - ["[env] %s was defined, using: %s", "PASSWORD", "***"] + ["[env] %s was defined, using: %s", "PASSWORD", "***"], + ["[env] %s was not defined, using default: %s", "PASSWORD2", "***"] ]); });