function TestNode.expand(V)local L=getfenv(V.callback)local B=setmetatable({},{__index=L})for V,L in pairs(V.environment)do B[V]=L end B.script=L.script setfenv(V.callback,B)local U,A=xpcall(V.callback,function(V)return debug.traceback(tostring(V),2)end)if not U then V.loadError=A end end local V={}V.__index=V
--[[
	Expand a node by setting its callback environment and then calling it. Any
	further it and describe calls within the callback will be added to the tree.
]]
function TestNode:expand()
	local originalEnv = getfenv(self.callback)
	local callbackEnv = setmetatable({}, { __index = originalEnv })
	for key, value in pairs(self.environment) do
		callbackEnv[key] = value
	end
	-- Copy 'script' directly to new env to make Studio debugger happy.
	-- Studio debugger does not look into __index, because of security reasons
	callbackEnv.script = originalEnv.script
	setfenv(self.callback, callbackEnv)

	local success, result = xpcall(self.callback, function(message)
		return debug.traceback(tostring(message), 2)
	end)

	if not success then
		self.loadError = result
	end
end

local TestPlan = {}
TestPlan.__index = TestPlan
