sails-js-hook-dotenv
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -29,6 +29,14 @@ # CHANGELOG | ||
* Removing dependency on should package by @ActuallyConnor in https://github.com/ActuallyConnor/sails-js-hook-dotenv/pull/4 | ||
* Fixing README.md by @ActuallyConnor in https://github.com/ActuallyConnor/sails-js-hook-dotenv/pull/3 | ||
* Migrating to ES6 syntax by @ActuallyConnor in https://github.com/ActuallyConnor/sails-js-hook-dotenv/pull/5 | ||
-Removing dependency on should package by @ActuallyConnor in https://github.com/ActuallyConnor/sails-js-hook-dotenv/pull/4 | ||
-Fixing README.md by @ActuallyConnor in https://github.com/ActuallyConnor/sails-js-hook-dotenv/pull/3 | ||
-Migrating to ES6 syntax by @ActuallyConnor in https://github.com/ActuallyConnor/sails-js-hook-dotenv/pull/5 | ||
**Full Changelog**: https://github.com/ActuallyConnor/sails-js-hook-dotenv/compare/1.0.2...1.0.3 | ||
#### 1.0.4 | ||
- Updating testing strategy to match other hook testing strategies by @ActuallyConnor in https://github.com/ActuallyConnor/sails-js-hook-dotenv/pull/7 | ||
- Adding GitHub workflow by @ActuallyConnor in https://github.com/ActuallyConnor/sails-js-hook-dotenv/pull/8 | ||
**Full Changelog**: https://github.com/ActuallyConnor/sails-js-hook-dotenv/compare/1.0.3...1.0.4 |
{ | ||
"name": "sails-js-hook-dotenv", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Sails.js hook for loading .env files", | ||
@@ -27,2 +27,3 @@ "main": "index.js", | ||
"devDependencies": { | ||
"@sailshq/lodash": "^3.10.4", | ||
"mocha": "^9.2.0", | ||
@@ -29,0 +30,0 @@ "sails": "^1.5.2" |
const Sails = require('sails').Sails | ||
const _ = require('@sailshq/lodash'); | ||
const assert = require('assert') | ||
describe('Sails Hook Dotenv', function () { | ||
describe('Sails Hook Dotenv', () => { | ||
let sails | ||
let app | ||
let defaults | ||
before(done => { | ||
this.timeout(11000) | ||
app = new Sails() | ||
Sails().lift({ | ||
app.load({ | ||
globals: false, | ||
hooks: { | ||
@@ -17,12 +20,9 @@ 'dotenv': require('../'), | ||
}, | ||
loadHooks: ['dotenv'], | ||
log: { | ||
level: 'error', | ||
}, | ||
}, (err, _sails) => { | ||
if (err) { | ||
return done(err) | ||
} | ||
}, () => { | ||
defaults = app.hooks.dotenv.defaults.dotenv | ||
sails = _sails | ||
return done() | ||
@@ -33,9 +33,13 @@ }) | ||
after(done => { | ||
return sails ? sails.lower(done) : done() | ||
app.lower(done) | ||
}) | ||
it('sails does not crash', () => { | ||
return true | ||
it('should have initialize the dotenv hook', () => { | ||
assert(app.hooks.dotenv) | ||
}) | ||
it('should have dotenv throwOnFailure be set to true', () => { | ||
assert(_.isBoolean(defaults.throwOnFailure)) | ||
}) | ||
it('env vars are loaded from .env file', () => { | ||
@@ -42,0 +46,0 @@ assert.equal(process.env.test_hit, 'foo bar') |
9203
17
65
3