config-loader: forward null values

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2024-02-29 14:46:19 +01:00
parent b130eb36b4
commit db8358d6b1
3 changed files with 11 additions and 4 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/config-loader': minor
---
Forward `null` values read from configuration files in configuration data, rather treating them as absence of config.
@@ -17,7 +17,7 @@
import { applyConfigTransforms } from './apply';
describe('applyConfigTransforms', () => {
it('should apply not transforms to input', async () => {
it('should apply no transforms to input', async () => {
const data = applyConfigTransforms(
{
app: {
@@ -35,7 +35,8 @@ describe('applyConfigTransforms', () => {
app: {
title: 'Test',
x: 1,
y: [true],
y: [null, true],
z: null,
},
});
});
@@ -77,7 +78,8 @@ describe('applyConfigTransforms', () => {
app: {
title: ['T', 'e', 's', 't'],
x: 2,
y: [true],
y: [null, true],
z: null,
},
});
});
@@ -58,7 +58,7 @@ export async function applyConfigTransforms(
if (typeof obj !== 'object') {
return obj;
} else if (obj === null) {
return undefined;
return null;
} else if (Array.isArray(obj)) {
const arr = new Array<JsonValue>();