Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #322 from kgoerlitz/master
Fix #321 - TypeError: Property description must be an object: undefined
- Loading branch information
Showing
4 changed files
with
57 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
|
||
// Dependencies | ||
var vows = require('vows'), | ||
assert = require('assert'), | ||
path = require('path'); | ||
|
||
// Change the configuration directory for testing | ||
process.env.NODE_CONFIG_DIR = __dirname + '/8-config'; | ||
|
||
// Hardcode $NODE_ENV=test for testing | ||
delete process.env.NODE_ENV; | ||
|
||
// Test for multi-instance applications | ||
delete process.env.NODE_APP_INSTANCE; | ||
|
||
process.env.NODE_CONFIG_STRICT_MODE = false; | ||
|
||
var CONFIG = requireUncached('../lib/config'); | ||
|
||
|
||
vows.describe('Tests for config extending') | ||
.addBatch({ | ||
'Extending a base configuration with another configuration': { | ||
'Extending a configuration with another configuration should work without error': function () { | ||
|
||
process.env.NODE_CONFIG_DIR = __dirname + '/8-config'; | ||
var base_config = require(process.env.NODE_CONFIG_DIR + path.sep + 'base-config.json'); | ||
CONFIG.util.attachProtoDeep(base_config); | ||
|
||
assert.doesNotThrow(function () { | ||
result = CONFIG.util.extendDeep(base_config, CONFIG); | ||
}, 'Extending a configuration with another configuration has an error'); | ||
|
||
} | ||
} | ||
}) | ||
.export(module); | ||
|
||
// | ||
// Because require'ing config creates and caches a global singleton, | ||
// We have to invalidate the cache to build new object based on the environment variables above | ||
function requireUncached(module) { | ||
delete require.cache[require.resolve(module)]; | ||
return require(module); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"testValue": "base configuration value", | ||
"anotherValue": "Another value" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"testValue": "override configuration value" | ||
} |