diff --git a/src/TemplateProcessor.ts b/src/TemplateProcessor.ts index 9b1669da..cc51bc78 100644 --- a/src/TemplateProcessor.ts +++ b/src/TemplateProcessor.ts @@ -1157,7 +1157,7 @@ export default class TemplateProcessor { resolve({ "error": { message: `wait condition ${waitCondition} timed out in ${timeout}ms`, - output: this.output + output: JSON.parse(JSON.stringify(this.output)) // deep copy } }); } else { @@ -1171,7 +1171,7 @@ export default class TemplateProcessor { this.removeDataChangeCallback('/'); clearTimeout(timeoutId); // Clear the timeout when condition is met this.logger.debug(`received data change matching ${waitCondition} for ${jsonPtr} with data ${data}`); - resolve(this.output); + resolve(JSON.parse(JSON.stringify(this.output))); // deep copy } else { this.logger.debug(`received data change not matching ${waitCondition} for ${jsonPtr} with data ${data}`); }