Improve expect output in edge case

This commit is contained in:
Amber Grace 2022-10-26 12:20:39 -06:00 committed by GitHub
parent 2c6f433903
commit f78ca77dd2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1669,7 +1669,13 @@ end
local function expectHelper(status, ...)
if status ~= Promise.Status.Resolved then
error((...) == nil and "Expected Promise rejected with no value." or (...), 3)
local message = (...)
error(
if (message == nil) or (message == "")
then "Expected Promise rejected with no value."
else message,
3
)
end
return ...