forked from Roblox/roact-rodux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrunner.server.lua
62 lines (49 loc) · 1.34 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
53
54
55
56
57
58
59
60
61
62
--[[
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.
]]
-- luacheck: globals __LEMUR__
local isRobloxCli, ProcessService = pcall(game.GetService, game, "ProcessService")
local completed, result = xpcall(function()
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Roact = require(ReplicatedStorage.Roact)
local TestEZ = require(ReplicatedStorage.TestEZ)
Roact.setGlobalConfig({
internalTypeChecks = true,
typeChecks = true,
elementTracing = true,
propValidation = true,
})
local results = TestEZ.TestBootstrap:run(
{ ReplicatedStorage.RoactRodux },
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:Exit(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