diff --git a/packages/node_modules/@node-red/runtime/lib/flows/Group.js b/packages/node_modules/@node-red/runtime/lib/flows/Group.js index 90d93cf45..589cdf115 100644 --- a/packages/node_modules/@node-red/runtime/lib/flows/Group.js +++ b/packages/node_modules/@node-red/runtime/lib/flows/Group.js @@ -1,5 +1,6 @@ const flowUtil = require("./util"); const credentials = require("../nodes/credentials"); +const clone = require("clone"); /** * This class represents a group within the runtime. diff --git a/test/unit/@node-red/runtime/lib/flows/Group_spec.js b/test/unit/@node-red/runtime/lib/flows/Group_spec.js index b547b1c77..1b22b962d 100644 --- a/test/unit/@node-red/runtime/lib/flows/Group_spec.js +++ b/test/unit/@node-red/runtime/lib/flows/Group_spec.js @@ -16,6 +16,31 @@ describe('Group', function () { group.getSetting("NR_GROUP_NAME").should.equal("g1") group.getSetting("NR_GROUP_ID").should.equal("group1") }) + it("returns cloned env var property", async function () { + const group = new Group({ + getSetting: v => v+v + }, { + name: "g1", + id: "group1", + env: [ + { + name: 'jsonEnvVar', + type: 'json', + value: '{"a":1}' + } + ] + }) + await group.start() + const result = group.getSetting('jsonEnvVar') + result.should.have.property('a', 1) + result.a = 2 + result.b = 'hello' + + const result2 = group.getSetting('jsonEnvVar') + result2.should.have.property('a', 1) + result2.should.not.have.property('b') + + }) it("delegates to parent if not found", async function () { const group = new Group({ getSetting: v => v+v