From 6cfb23ba3df10db48f06a377af4b510fa4d58375 Mon Sep 17 00:00:00 2001 From: Lucien Greathouse Date: Mon, 13 Jan 2020 14:21:45 -0800 Subject: [PATCH] Scripts to run tests in roblox-cli --- bin/run-tests.server.lua | 7 ++++++- bin/test-roblox-cli.sh | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100755 bin/test-roblox-cli.sh diff --git a/bin/run-tests.server.lua b/bin/run-tests.server.lua index 3a14fe41..cc51dabb 100644 --- a/bin/run-tests.server.lua +++ b/bin/run-tests.server.lua @@ -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) @@ -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 \ No newline at end of file diff --git a/bin/test-roblox-cli.sh b/bin/test-roblox-cli.sh new file mode 100755 index 00000000..5040bb65 --- /dev/null +++ b/bin/test-roblox-cli.sh @@ -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" \ No newline at end of file