Skip to content
This repository was archived by the owner on Jun 17, 2020. It is now read-only.

Commit 01d88c9

Browse files
committed
Add unit test for not replacing variables in JSON files
1 parent 418d391 commit 01d88c9

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

test/fixtures/envvars.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"simple": "${SIMPLE}"
3+
}

test/parsing-test.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ vows.describe('config file parsing').addBatch({
7171
assert.ok(err.indexOf('JSON config file parsing failed (SyntaxError: Unexpected token') === 0);
7272
}
7373
},
74-
'should interpolate environment variables': {
74+
'should interpolate environment variables in YAML': {
7575
topic: importFile(path.join(fixtures, 'envvars.yaml'), null, {
7676
SIMPLE: 'foo'
7777
}),
@@ -81,5 +81,13 @@ vows.describe('config file parsing').addBatch({
8181
'should allow a default value for a variable': function(err, options) {
8282
assert.equal(options.default, 'baz/bar');
8383
}
84+
},
85+
'should not interpolate environment variables in JSON': {
86+
topic: importFile(path.join(fixtures, 'envvars.json'), null, {
87+
SIMPLE: 'foo'
88+
}),
89+
'should not replace the variable': function(err, options) {
90+
assert.equal(options.simple, '${SIMPLE}');
91+
}
8492
}
8593
}).export(module);

0 commit comments

Comments
 (0)