local E="\084\101\115\116\069\090\084\101\115\116\082\111\111\116"local p,n=pcall(game.GetService,game,"\067\111\108\108\101\099\116\105\111\110\083\101\114\118\105\099\101")local h,f=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(E)print(E)M.exit(1)end elseif h then M.exit=function(E)f:Exit(E)end M.error=function(E)print(E)M.exit(1)end else M.exit=function() end M.error=function(E)error(E,0)end end local c,m=xpcall(function()local h=require(script.TestEZ)local f if p then f=n:GetTagged(E)else f=_G.TESTEZ_TEST_CONTAINERS end if#f==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",E))return true end local M=h.TestBootstrap:run(f,h.Reporters.TextReporter)return M.failureCount==0 end,debug.traceback)if c then if m then M.exit(0)else M.exit(1)end else M.error(m)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:Exit(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