Skip to content
This repository has been archived by the owner on Dec 13, 2023. It is now read-only.

Commit

Permalink
Update TestEZ and fix tests so they work in studio (#318)
Browse files Browse the repository at this point in the history
  • Loading branch information
oltrep authored Sep 16, 2021
1 parent 4796c79 commit 97a30b3
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 14 deletions.
3 changes: 2 additions & 1 deletion .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ stds.testez = {
read_globals = {
"describe",
"it", "itFOCUS", "itSKIP",
"FOCUS", "SKIP", "HACK_NO_XPCALL",
"FOCUS", "SKIP",
"expect",
"beforeEach", "afterEach", "beforeAll", "afterAll",
}
}

Expand Down
13 changes: 7 additions & 6 deletions bin/run-tests.server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@ Roact.setGlobalConfig({
["elementTracing"] = true,
["propValidation"] = true,
})
local results = TestEZ.TestBootstrap:run(ReplicatedStorage.Roact, TestEZ.Reporters.TextReporter)
local results = TestEZ.TestBootstrap:run(
{ ReplicatedStorage.Roact },
TestEZ.Reporters.TextReporter
)

local statusCode = results.failureCount == 0 and 0 or 1
local statusCode = (results.failureCount == 0 and #results.errors == 0) and 0 or 1

if __LEMUR__ then
if results.failureCount > 0 then
os.exit(statusCode)
end
os.exit(statusCode)
elseif isRobloxCli then
ProcessService:Exit(statusCode)
ProcessService:ExitAsync(statusCode)
end
2 changes: 1 addition & 1 deletion bin/spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
-- If you add any dependencies, add them to this table so they'll be loaded!
local LOAD_MODULES = {
{"src", "Roact"},
{"modules/testez/lib", "TestEZ"},
{"modules/testez/src", "TestEZ"},
}

-- This makes sure we can load Lemur and other libraries that depend on init.lua
Expand Down
2 changes: 1 addition & 1 deletion modules/testez
Submodule testez updated 103 files
2 changes: 1 addition & 1 deletion place.project.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},

"TestEZ": {
"$path": "modules/testez/lib"
"$path": "modules/testez"
}
},

Expand Down
21 changes: 17 additions & 4 deletions src/RobloxRenderer.spec.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
return function()
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local assertDeepEqual = require(script.Parent.assertDeepEqual)
local Binding = require(script.Parent.Binding)
local Children = require(script.Parent.PropMarkers.Children)
Expand Down Expand Up @@ -950,6 +952,17 @@ return function()


describe("Integration Tests", function()
local temporaryParent = nil
beforeEach(function()
temporaryParent = Instance.new("Folder")
temporaryParent.Parent = ReplicatedStorage
end)

afterEach(function()
temporaryParent:Destroy()
temporaryParent = nil
end)

it("should not allow re-entrancy in updateChildren", function()
local configValues = {
tempFixUpdateChildrenReEntrancy = true,
Expand Down Expand Up @@ -1007,7 +1020,7 @@ return function()
end

local parent = Instance.new("ScreenGui")
parent.Parent = game.CoreGui
parent.Parent = temporaryParent

local tree = createElement(ParentComponent)

Expand Down Expand Up @@ -1101,7 +1114,7 @@ return function()
end

local parent = Instance.new("ScreenGui")
parent.Parent = game.CoreGui
parent.Parent = temporaryParent

local tree = createElement(ParentComponent)

Expand Down Expand Up @@ -1235,7 +1248,7 @@ return function()
end

local parent = Instance.new("ScreenGui")
parent.Parent = game.CoreGui
parent.Parent = temporaryParent

local tree = createElement(ParentComponent)

Expand Down Expand Up @@ -1335,7 +1348,7 @@ return function()
end

local parent = Instance.new("ScreenGui")
parent.Parent = game.CoreGui
parent.Parent = temporaryParent

local tree = createElement(ParentComponent)

Expand Down

0 comments on commit 97a30b3

Please sign in to comment.