Skip to content

Commit 486cea3

Browse files
committed
test: $extends test with $env in extended file and global env override
1 parent df01267 commit 486cea3

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

app-config-extensions/src/extends-directive.test.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,23 @@ describe('$extends directive', () => {
4545
);
4646
});
4747

48+
it('merges two files with env in extends file and global env override', async () => {
49+
await withTempFiles(
50+
{
51+
'referenced-file.json': `{ "foo": { "$env": { "prod": true, "qa": false } } }`,
52+
'test-file.json': `{ "$extends": "./referenced-file.json", "bar": true }`,
53+
},
54+
async (inDir) => {
55+
const source = new FileSource(inDir('test-file.json'));
56+
const parsed = await source.read([extendsDirective(), envDirective()], {
57+
environmentOptions: { override: 'prod' },
58+
});
59+
60+
expect(parsed.toJSON()).toEqual({ foo: true, bar: true });
61+
},
62+
);
63+
});
64+
4865
it('merges many files (flat)', async () => {
4966
await withTempFiles(
5067
{

0 commit comments

Comments
 (0)