Integration is a go!

This commit is contained in:
Lucien Greathouse 2018-08-25 20:58:17 -07:00
parent 008f50efd7
commit ea02a5078d
14 changed files with 183 additions and 95 deletions

View file

@ -0,0 +1,37 @@
--[[
Loads the Rojo plugin and all of its dependencies.
]]
local function loadEnvironment()
-- If you add any dependencies, add them to this table so they'll be loaded!
local LOAD_MODULES = {
{"src", "Rojo"},
{"modules/promise/lib", "Promise"},
{"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 run `lua bin/install-dependencies.lua` first!
local lemur = require("modules.lemur")
-- Create a virtual Roblox tree
local habitat = lemur.Habitat.new()
-- We'll put all of our library code and dependencies here
local modules = lemur.Instance.new("Folder")
modules.Name = "Modules"
modules.Parent = habitat.game:GetService("ReplicatedStorage")
-- Load all of the modules specified above
for _, module in ipairs(LOAD_MODULES) do
local container = habitat:loadFromFs(module[1])
container.Name = module[2]
container.Parent = modules
end
return habitat, modules
end
return loadEnvironment

@ -1 +1 @@
Subproject commit 86b33cdfb46fd1e736f8ee1d8861d1b58ffa987f
Subproject commit 96d4166a2d9e146e6955eeacccc0c79a86a177f5

View file

@ -4,31 +4,31 @@
"partitions": {
"plugin": {
"path": "src",
"target": "ReplicatedStorage.Rojo.modules.Plugin"
"target": "ReplicatedStorage.Rojo.Modules.Plugin"
},
"modules/roact": {
"path": "modules/roact/lib",
"target": "ReplicatedStorage.Rojo.modules.Roact"
"target": "ReplicatedStorage.Rojo.Modules.Roact"
},
"modules/rodux": {
"path": "modules/rodux/lib",
"target": "ReplicatedStorage.Rojo.modules.Rodux"
"target": "ReplicatedStorage.Rojo.Modules.Rodux"
},
"modules/roact-rodux": {
"path": "modules/roact-rodux/lib",
"target": "ReplicatedStorage.Rojo.modules.RoactRodux"
"target": "ReplicatedStorage.Rojo.Modules.RoactRodux"
},
"modules/promise": {
"path": "modules/promise/lib",
"target": "ReplicatedStorage.Rojo.modules.Promise"
"target": "ReplicatedStorage.Rojo.Modules.Promise"
},
"modules/testez": {
"path": "modules/testez/lib",
"target": "ReplicatedStorage.TestEZ"
},
"tests": {
"path": "tests",
"target": "TestService"
"path": "testBootstrap.server.lua",
"target": "TestService.testBootstrap"
}
}
}

15
plugin/runTest.lua Normal file
View file

@ -0,0 +1,15 @@
local loadEnvironment = require("loadEnvironment")
local testPath = assert((...), "Please specify a path to a test file.")
local habitat = loadEnvironment()
local testModule = habitat:loadFromFs(testPath)
if testModule == nil then
error("Couldn't find test file at " .. testPath)
end
print("Starting test module.")
habitat:require(testModule)

View file

@ -2,37 +2,14 @@
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 = {
{"src", "plugin"},
{"modules/promise/lib", "Promise"},
{"modules/testez/lib", "TestEZ"},
}
local loadEnvironment = require("loadEnvironment")
-- 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 run `lua bin/install-dependencies.lua` first!
local lemur = require("modules.lemur")
-- Create a virtual Roblox tree
local habitat = lemur.Habitat.new()
-- 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]
container.Parent = Root
end
local habitat, modules = loadEnvironment()
-- Load TestEZ and run our tests
local TestEZ = habitat:require(Root.TestEZ)
local TestEZ = habitat:require(modules.TestEZ)
local results = TestEZ.TestBootstrap:run(Root.plugin, TestEZ.Reporters.TextReporter)
local results = TestEZ.TestBootstrap:run(modules.Rojo, TestEZ.Reporters.TextReporter)
-- Did something go wrong?
if results.failureCount > 0 then

View file

@ -0,0 +1,2 @@
local TestEZ = require(game.ReplicatedStorage.TestEZ)
TestEZ.TestBootstrap:run(game.ReplicatedStorage.Rojo.plugin)

5
plugin/tests/empty.lua Normal file
View file

@ -0,0 +1,5 @@
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Session = require(ReplicatedStorage.Modules.Rojo.Session)
Session.new()

View file

@ -1,2 +0,0 @@
local TestEZ = require(game.ReplicatedStorage.TestEZ)
TestEZ.TestBootstrap:run(game.ReplicatedStorage.Rojo.plugin)