This repository has been archived by the owner on Feb 16, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
spec.lua
48 lines (39 loc) · 1.46 KB
/
spec.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
--[[
Loads our library and all of its dependencies, then runs tests using TestEZ.
]]
-- If you add any dependencies, add them to this table so they'll be loaded!
local LOAD_MODULES = {
{"lib/shared", "WorldEngine", "ReplicatedStorage"},
{"lib/server", "WorldEngine", "ServerScriptService"},
{"modules/testez/lib", "TestEZ"}
}
-- This makes sure we can load Lemur and other libraries that depend on init.lua
package.path = package.path .. ";?/init.lua"
-- If this fails, make sure you've cloned all Git submodules of this repo!
local lemur = require("modules.lemur")
-- Create a virtual Roblox tree
local habitat = lemur.Habitat.new()
local game = habitat.game
local replicated = game:GetService("ReplicatedStorage")
local ServerScriptService = game:GetService("ServerScriptService")
-- We'll put all of our library code and dependencies here
local Root = lemur.Instance.new("Folder")
Root.Name = "Root"
-- Load all of the modules specified above
for _, module in ipairs(LOAD_MODULES) do
local container = habitat:loadFromFs(module[1])
container.Name = module[2]
local parent = module[3]
if (parent) then
container.Parent = game:GetService(parent)
else
container.Parent = Root
end
end
-- Load TestEZ and run our tests
local TestEZ = habitat:require(Root.TestEZ)
local results = TestEZ.TestBootstrap:run({replicated.WorldEngine, ServerScriptService.WorldEngine}, TestEZ.Reporters.TextReporter)
-- Did something go wrong?
if results.failureCount > 0 then
os.exit(1)
end