fix: fix the getValue of yaml
1. Fix the yaml value dump in the utils 2. Update the unit test Change-Id: I3c2120593ff533d38fdc7cb026d0d2d3bf1e7132
This commit is contained in:
parent
a307f457e4
commit
f4a24d04ad
@ -18,8 +18,9 @@ import yaml from 'js-yaml';
|
|||||||
export const getValue = (value) => {
|
export const getValue = (value) => {
|
||||||
if (isObject(value)) {
|
if (isObject(value)) {
|
||||||
try {
|
try {
|
||||||
return yaml.safeDump(value, { noRefs: true });
|
return yaml.dump(value, { noRefs: true });
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
console.log('yaml-dump-err', err);
|
||||||
return JSON.stringify(value, null, 2);
|
return JSON.stringify(value, null, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,12 +24,9 @@ describe('test yaml', () => {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
).toBe(`{
|
).toBe(`level1:
|
||||||
"level1": {
|
level2:
|
||||||
"level2": {
|
key: value
|
||||||
"key": "value"
|
`);
|
||||||
}
|
|
||||||
}
|
|
||||||
}`);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user