@myob-oss/config
Advanced tools
Comparing version 1.0.6 to 1.0.7
@@ -8,6 +8,2 @@ const Config = require('./config.js'); | ||
constructor() { | ||
if (JSON.stringify(effectiveConfigObject) !== '{}') { | ||
return; | ||
} | ||
const file = new File(); | ||
@@ -14,0 +10,0 @@ const defaultConfigObject = file.getFileContents('default.json'); |
{ | ||
"name": "@myob-oss/config", | ||
"version": "1.0.6", | ||
"description": "A simple, slightly opinionated, and predictable configuration module.", | ||
"version": "1.0.7", | ||
"description": "A simple, slightly opinionated, and predictable configuration module for Node.js applications.", | ||
"main": "lib/config-wrapper.js", | ||
@@ -22,14 +22,14 @@ "scripts": { | ||
"deepmerge": "^2.1.1", | ||
"json5": "^1.0.1" | ||
"json5": "^2.0.1" | ||
}, | ||
"devDependencies": { | ||
"eslint": "^5.0.1", | ||
"eslint-config-airbnb-base": "^13.0.0", | ||
"eslint-plugin-import": "^2.13.0", | ||
"eslint": "^5.4.0", | ||
"eslint-config-airbnb-base": "^13.1.0", | ||
"eslint-plugin-import": "^2.14.0", | ||
"gulp": "^3.9.1", | ||
"gulp-eslint": "^4.0.2", | ||
"gulp-eslint": "^5.0.0", | ||
"gulp-mocha": "^6.0.0", | ||
"istanbul": "^0.4.5", | ||
"mocha": "^5.2.0", | ||
"should": "^13.2.1" | ||
"should": "^13.2.3" | ||
}, | ||
@@ -36,0 +36,0 @@ "engines": { |
@@ -19,2 +19,12 @@ /* global it:false, describe:false */ | ||
}); | ||
it('Should expose the same configuration if it is required for a third time later on', (done) => { | ||
setTimeout(() => { | ||
const config3 = require('../../lib/config-wrapper.js'); // eslint-disable-line global-require | ||
config3.should.have.property('configurationFile'); | ||
config3.configurationFile.should.eql('runtime'); | ||
config3.configurationFile.should.eql(config.configurationFile); | ||
done(); | ||
}, 300); | ||
}); | ||
}); |
@@ -30,2 +30,10 @@ /* global it:false, describe:false, beforeEach:false */ | ||
it('Should not get the contents of a file which does not exist', (done) => { | ||
const result = file.getFileContents('some-file-which-does-not-exist.json'); | ||
result.should.eql({}); | ||
done(); | ||
}); | ||
it('Should get the environment', (done) => { | ||
@@ -35,15 +43,15 @@ const currentEnvironment = process.env.NODE_ENV; | ||
process.env.NODE_ENV = 'test'; | ||
let result = file.getEnvironment(); | ||
result.should.eql('test'); | ||
process.env.NODE_ENV = null; | ||
result = file.getEnvironment(); | ||
result.should.eql('production'); | ||
delete process.env.NODE_ENV; | ||
result = file.getEnvironment(); | ||
result.should.eql('production'); | ||
process.env.NODE_ENV = 'null'; | ||
result = file.getEnvironment(); | ||
result.should.eql('production'); | ||
@@ -50,0 +58,0 @@ |
Sorry, the diff of this file is not supported yet
18873
351
8
+ Addedjson5@2.2.3(transitive)
- Removedjson5@1.0.2(transitive)
- Removedminimist@1.2.8(transitive)
Updatedjson5@^2.0.1