local c="\084\101\115\116\069\090\084\101\115\116\082\111\111\116"local M,n=pcall(game.GetService,game,"\067\111\108\108\101\099\116\105\111\110\083\101\114\118\105\099\101")local F,I=pcall(game.GetService,game,"\080\114\111\099\101\115\115\083\101\114\118\105\099\101")local m={}if __LEMUR__ then m.exit=os.exit m.error=function(c)print(c)m.exit(1)end elseif F then m.exit=function(c)I:ExitAsync(c)end m.error=function(c)print(c)m.exit(1)end else m.exit=function() end m.error=function(c)error(c,0)end end local H,C=xpcall(function()local F=require(script.TestEZ)local I if M then I=n:GetTagged(c)else I=_G.TESTEZ_TEST_CONTAINERS end if#I==0 then print(string.format("\078\111 \116\101\115\116\115 \102\111\117\110\100\046 \068\105\100 \121\111\117 \103\105\118\101 \116\104\101\109 \116\104\101 \067\111\108\108\101\099\116\105\111\110\083\101\114\118\105\099\101 \116\097\103 \037\113\063",c))return true end local m=F.TestBootstrap:run(I,F.Reporters.TextReporter)return m.failureCount==0 end,debug.traceback)if H then if C then m.exit(0)else m.exit(1)end else m.error(C)end
--[[
	This test runner is invoked in all the environments that we want to test our
	project in.

	TestEZ's CLI targets Lemur, Roblox Studio, and Roblox-CLI.

	Assumes TestEZ is put into ReplicatedStorage and that test roots have a
	"TestEZTestRoot" CollectionService tag attached to them.
]]

-- luacheck: globals game script __LEMUR__

local TEST_CONTAINER_TAG = "TestEZTestRoot"

local hasCollectionService, CollectionService = pcall(game.GetService, game, "CollectionService")

-- ProcessService only exists when running under Roblox-CLI.
local isRobloxCli, ProcessService = pcall(game.GetService, game, "ProcessService")

local platform = {}

if __LEMUR__ then
	platform.exit = os.exit

	platform.error = function(message)
		print(message)
		platform.exit(1)
	end
elseif isRobloxCli then
	platform.exit = function(statusCode)
		ProcessService:ExitAsync(statusCode)
	end

	platform.error = function(message)
		print(message)
		platform.exit(1)
	end
else
	platform.exit = function() end

	platform.error = function(message)
		error(message, 0)
	end
end

local completed, suitePassed = xpcall(function()
	local TestEZ = require(script.TestEZ)

	local testContainers
	if hasCollectionService then
		testContainers = CollectionService:GetTagged(TEST_CONTAINER_TAG)
	else
		testContainers = _G.TESTEZ_TEST_CONTAINERS
	end

	if #testContainers == 0 then
		print(string.format(
			"No tests found. Did you give them the CollectionService tag %q?",
			TEST_CONTAINER_TAG
		))

		return true
	end

	local testResults = TestEZ.TestBootstrap:run(
		testContainers,
		TestEZ.Reporters.TextReporter
	)

	return testResults.failureCount == 0
end, debug.traceback)

if completed then
	if suitePassed then
		platform.exit(0)
	else
		platform.exit(1)
	end
else
	platform.error(suitePassed)
end