Skip to content

Commit

Permalink
Merge branch 'release/v1.0.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
keithmorris committed Oct 23, 2016
2 parents d0d285d + d0c1d77 commit b013a05
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 12 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## 1.0.4 - 2016.10.23
- Replace `winston` library with generic `console` (Thanks @bostrom)

## 1.0.3 - 2016.08.06
- Fix comma-space typo in thrown error (Thanks @niftylettuce)

Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dotenv-extended",
"version": "1.0.3",
"version": "1.0.4",
"description": "A module for loading .env files and optionally loading defaults and a schema for validating all values are present.",
"repository": "[email protected]:keithmorris/node-dotenv-extended.git",
"main": "lib/index.js",
Expand Down Expand Up @@ -47,7 +47,6 @@
},
"dependencies": {
"dotenv": "^2.0.0",
"lodash": "^4.3.0",
"winston": "^2.1.1"
"lodash": "^4.3.0"
}
}
3 changes: 1 addition & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@
import _ from 'lodash';
import dotenv from 'dotenv';
import fs from 'fs';
import winston from 'winston';

function loadEnvironmentFile(path, encoding, silent) {
try {
var data = fs.readFileSync(path, encoding);
return dotenv.parse(data);
} catch (err) {
if (!silent) {
winston.error(err.message);
console.error(err.message);
}
return {};
}
Expand Down
10 changes: 3 additions & 7 deletions test/test.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,15 @@ var chai = require('chai'),
chai.use(sinonChai);

describe('dotenv-extended tests', function () {
var dotenvex, winstonStub;
var dotenvex;

before(function () {
mockery.enable({
warnOnReplace: false,
warnOnUnregistered: false,
useCleanCache: true
});

winstonStub = {
error: sinon.stub()
};
mockery.registerMock('winston', winstonStub);
sinon.stub(console, 'error');
dotenvex = require('../');
});

Expand Down Expand Up @@ -108,6 +104,6 @@ describe('dotenv-extended tests', function () {

it('Should log an error when silent is set to false and .env.defaults is missing', function () {
dotenvex.load({ silent: false });
expect(winstonStub.error).to.have.been.calledOnce;
expect(console.error).to.have.been.calledOnce;
});
});

0 comments on commit b013a05

Please sign in to comment.