forked from Roblox/roact-rodux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce new test runner scripts (Roblox#25)
- Loading branch information
Showing
7 changed files
with
117 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/sh | ||
|
||
# Usage: ./test/roblox-cli.sh | ||
|
||
if [ ! -z ${LOCALAPPDATA+x} ]; then | ||
# Probably Windows, look for any Roblox installation in the default path. | ||
|
||
VERSIONS_FOLDER="$LOCALAPPDATA/Roblox/Versions" | ||
INSTALL=`find "$VERSIONS_FOLDER" -maxdepth 1 -name version-* | head -1` | ||
CONTENT="$INSTALL/content" | ||
else | ||
# Probably macOS, look for Roblox Studio in its default path. | ||
|
||
CONTENT="/Applications/RobloxStudio.App/Contents/Resources/content" | ||
fi | ||
|
||
rojo build test-place.project.json -o TestPlace.rbxlx | ||
roblox-cli run --load.place TestPlace.rbxlx --assetFolder "$CONTENT" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
--[[ | ||
This test runner is invoked in all the environments that we want to test our | ||
library in. | ||
We target Lemur, Roblox Studio, and Roblox-CLI. | ||
]] | ||
|
||
-- luacheck: globals __LEMUR__ | ||
|
||
local isRobloxCli, ProcessService = pcall(game.GetService, game, "ProcessService") | ||
|
||
local completed, result = xpcall(function() | ||
local ReplicatedStorage = game:GetService("ReplicatedStorage") | ||
|
||
local Roact = require(ReplicatedStorage.Roact) | ||
local TestEZ = require(ReplicatedStorage.TestEZ) | ||
|
||
Roact.setGlobalConfig({ | ||
-- ["internalTypeChecks"] = true, | ||
-- ["typeChecks"] = true, | ||
elementTracing = true, | ||
-- ["propValidation"] = true, | ||
}) | ||
|
||
local results = TestEZ.TestBootstrap:run( | ||
ReplicatedStorage.RoactRodux, | ||
TestEZ.Reporters.TextReporter | ||
) | ||
|
||
return results.failureCount == 0 and 0 or 1 | ||
end, debug.traceback) | ||
|
||
local statusCode | ||
local errorMessage = nil | ||
if completed then | ||
statusCode = result | ||
else | ||
statusCode = 1 | ||
errorMessage = result | ||
end | ||
|
||
if __LEMUR__ then | ||
-- Lemur has access to normal Lua OS APIs | ||
|
||
if errorMessage ~= nil then | ||
print(errorMessage) | ||
end | ||
os.exit(statusCode) | ||
elseif isRobloxCli then | ||
-- Roblox CLI has a special service to terminate the process | ||
|
||
if errorMessage ~= nil then | ||
print(errorMessage) | ||
end | ||
ProcessService:Exit(statusCode) | ||
else | ||
-- In Studio, we can just throw an error to get the user's attention | ||
|
||
if errorMessage ~= nil then | ||
error(errorMessage, 0) | ||
end | ||
end |