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

Commit

Permalink
Merge pull request #248 from LPGhatguy/roblox-cli
Browse files Browse the repository at this point in the history
Add support for running tests via Roblox CLI
  • Loading branch information
MisterUncloaked committed Jan 14, 2020
2 parents 31fa93d + 6cfb23b commit abb600a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
7 changes: 6 additions & 1 deletion bin/run-tests.server.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
-- luacheck: globals __LEMUR__

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local isRobloxCli, ProcessService = pcall(game.GetService, game, "ProcessService")

local Roact = require(ReplicatedStorage.Roact)
local TestEZ = require(ReplicatedStorage.TestEZ)
Expand All @@ -13,8 +14,12 @@ Roact.setGlobalConfig({
})
local results = TestEZ.TestBootstrap:run(ReplicatedStorage.Roact, TestEZ.Reporters.TextReporter)

local statusCode = results.failureCount == 0 and 0 or 1

if __LEMUR__ then
if results.failureCount > 0 then
os.exit(1)
os.exit(statusCode)
end
elseif isRobloxCli then
ProcessService:Exit(statusCode)
end
18 changes: 18 additions & 0 deletions bin/test-roblox-cli.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/sh

# Usage: ./bin/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 place.project.json -o TestPlace.rbxlx
roblox-cli run --load.place TestPlace.rbxlx --assetFolder "$CONTENT"

0 comments on commit abb600a

Please sign in to comment.