Skip to content
This repository was archived by the owner on Sep 14, 2024. It is now read-only.

Commit df00128

Browse files
authored
Merge pull request #140 from Roblox/bbrimeyer/feature/fix-tests-robloxcli
Fix up tests for roblox-cli
2 parents 058f3dc + 7a3e30a commit df00128

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

test/runner.server.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,11 @@ elseif isRobloxCli then
8686
if errorMessage ~= nil then
8787
print(errorMessage)
8888
end
89-
ProcessService:Exit(statusCode)
89+
ProcessService:ExitAsync(statusCode)
9090
else
9191
-- In Studio, we can just throw an error to get the user's attention
9292

9393
if errorMessage ~= nil then
9494
error(errorMessage, 0)
9595
end
96-
end
96+
end

tests/Expectation.lua

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,14 @@ return {
8888
end)
8989

9090
assert(not success, "should fail")
91+
-- Make sure we state the expected error
9192
assert(
92-
message:match("Expected function to throw an error containing \"foo\", but it threw: .+%.lua:%d+: oof"),
93+
message:match("Expected function to throw an error containing \"foo\""),
94+
("Error message does not match:\n%s\n"):format(message)
95+
)
96+
-- Make sure we state the actual error
97+
assert(
98+
message:match(": oof"),
9399
("Error message does not match:\n%s\n"):format(message)
94100
)
95101
end,
@@ -130,9 +136,14 @@ return {
130136
end)
131137

132138
assert(not success, "should fail")
139+
-- Make sure we state the expected error
140+
assert(
141+
message:match("Expected function to never throw an error containing \"oof\""),
142+
("Error message does not match:\n%s\n"):format(message)
143+
)
144+
-- Make sure we state the actual error
133145
assert(
134-
message:match("Expected function to never throw an error containing \"oof\", "
135-
.. "but it threw: .+%.lua:%d+: foo%-oof"),
146+
message:match(": foo%-oof"),
136147
("Error message does not match:\n%s\n"):format(message)
137148
)
138149
end,
@@ -255,4 +266,4 @@ return {
255266

256267
assert(success, "should succeed")
257268
end,
258-
}
269+
}

0 commit comments

Comments
 (0)