-
Notifications
You must be signed in to change notification settings - Fork 0
/
runner.server.lua
52 lines (41 loc) · 1.13 KB
/
runner.server.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
--[[
This test runner is invoked in all the environments that we want to test our
library in.
We target Lemur, Roblox Studio, and Roblox-CLI.
]]
local isRobloxCli, ProcessService = pcall(game.GetService, game, "ProcessService")
local completed, result = xpcall(function()
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TestEZ = require(ReplicatedStorage.TestEZ)
local results = TestEZ.TestBootstrap:run(
{ ReplicatedStorage.Rodux },
TestEZ.Reporters.TextReporter
)
return results.failureCount == 0 and 0 or 1
end, debug.traceback)
local statusCode
local errorMessage = nil
if completed then
statusCode = result
else
statusCode = 1
errorMessage = result
end
if __LEMUR__ then
-- Lemur has access to normal Lua OS APIs
if errorMessage ~= nil then
print(errorMessage)
end
os.exit(statusCode)
elseif isRobloxCli then
-- Roblox CLI has a special service to terminate the process
if errorMessage ~= nil then
print(errorMessage)
end
ProcessService:ExitAsync(statusCode)
else
-- In Studio, we can just throw an error to get the user's attention
if errorMessage ~= nil then
error(errorMessage, 0)
end
end