From 37d21cf76353ae6105f17ace70ea5600426f53d4 Mon Sep 17 00:00:00 2001 From: Thorarinn Sigurdsson Date: Tue, 13 Oct 2020 13:38:23 +0200 Subject: [PATCH] fix(cli): fix error rendering for yaml output Before this fix, any errors in command results would not be rendered (instead, an empty array was rendered). --- core/src/cli/params.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/cli/params.ts b/core/src/cli/params.ts index 6ac8e9e1e5..8d8789b565 100644 --- a/core/src/cli/params.ts +++ b/core/src/cli/params.ts @@ -25,7 +25,8 @@ export const OUTPUT_RENDERERS = { return stringify(data, null, 2) }, yaml: (data: DeepPrimitiveMap) => { - return safeDumpYaml(data, { noRefs: true }) + // Convert data to JSON object so that `safeDumpYaml` renders any errors. + return safeDumpYaml(JSON.parse(JSON.stringify(data)), { noRefs: true }) }, }