From 6e265d5a17a7cee51daa5afb3e7735725ce862b6 Mon Sep 17 00:00:00 2001 From: Stephen Leitnick Date: Wed, 8 Dec 2021 14:02:35 -0500 Subject: [PATCH] Test fix --- .github/workflows/ci.yaml | 2 +- TEST.md | 2 +- ci.lua => ci/unit.server.lua | 13 ------------- modules/component/init.spec.lua | 2 -- modules/enum-list/init.spec.lua | 2 -- modules/option/init.spec.lua | 2 -- modules/ser/init.spec.lua | 2 -- modules/signal/init.spec.lua | 2 -- modules/symbol/init.spec.lua | 2 -- modules/table-util/init.spec.lua | 2 -- modules/timer/init.spec.lua | 3 +-- modules/trove/init.spec.lua | 2 -- test.project.json | 19 +++++++++++++++++++ 13 files changed, 22 insertions(+), 33 deletions(-) rename ci.lua => ci/unit.server.lua (60%) create mode 100644 test.project.json diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index cffd69be..bc735197 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -62,7 +62,7 @@ jobs: run: rojo build default.project.json -o test.rbxl - name: Run tests - run: run-in-roblox --place test.rbxl --script ci.lua > test-out.txt + run: run-in-roblox --place test.rbxl --script ci\\unit.server.lua > test-out.txt continue-on-error: true timeout-minutes: 3 diff --git a/TEST.md b/TEST.md index 603d52bd..df6f72cb 100644 --- a/TEST.md +++ b/TEST.md @@ -3,7 +3,7 @@ Testing requires Python, Wally, Rojo, and Roblox Studio. 1. Run `python build_tests.py` or `python build_tests.py watch` -2. Run `rojo` +2. Run `rojo` against `test.project.json` 3. Sync project into a new Roblox Studio place 4. Run the Roblox Studio place 5. Check output window for test status diff --git a/ci.lua b/ci/unit.server.lua similarity index 60% rename from ci.lua rename to ci/unit.server.lua index 1ab14229..892ba7cc 100644 --- a/ci.lua +++ b/ci/unit.server.lua @@ -3,19 +3,6 @@ print("Running unit tests...") local ReplicatedStorage = game:GetService("ReplicatedStorage") local TestEZ = require(ReplicatedStorage.Test.Packages.TestEZ) --- local tests = {} --- for _,testFolder in ipairs(TestService.modules:GetChildren()) do --- local name = testFolder.Name:match("(.+)_test$") --- local module = testFolder:FindFirstChild(name) --- if module then --- table.insert(tests, module) --- else --- print("Failed to find module within " .. testFolder.Name) --- end --- end - --- TestEZ.TestBootstrap:run(tests) - -- Clear out package test files for _,testFolder in ipairs(ReplicatedStorage.Test.modules:GetChildren()) do local index = testFolder:FindFirstChild("_Index") diff --git a/modules/component/init.spec.lua b/modules/component/init.spec.lua index e49eac48..e661b4e7 100644 --- a/modules/component/init.spec.lua +++ b/modules/component/init.spec.lua @@ -1,5 +1,3 @@ -print("Running test for " .. script.Parent.Name) - return function() local Component = require(script.Parent) diff --git a/modules/enum-list/init.spec.lua b/modules/enum-list/init.spec.lua index 233f667d..880021fd 100644 --- a/modules/enum-list/init.spec.lua +++ b/modules/enum-list/init.spec.lua @@ -1,5 +1,3 @@ -print("Running test for " .. script.Parent.Name) - return function() local EnumList = require(script.Parent) diff --git a/modules/option/init.spec.lua b/modules/option/init.spec.lua index 317a6b14..f78105a7 100644 --- a/modules/option/init.spec.lua +++ b/modules/option/init.spec.lua @@ -1,5 +1,3 @@ -print("Running test for " .. script.Parent.Name) - return function() local Option = require(script.Parent) diff --git a/modules/ser/init.spec.lua b/modules/ser/init.spec.lua index 99926891..47e8ee5f 100644 --- a/modules/ser/init.spec.lua +++ b/modules/ser/init.spec.lua @@ -1,5 +1,3 @@ -print("Running test for " .. script.Parent.Name) - return function() local Ser = require(script.Parent) diff --git a/modules/signal/init.spec.lua b/modules/signal/init.spec.lua index b8dda2b8..43b1a898 100644 --- a/modules/signal/init.spec.lua +++ b/modules/signal/init.spec.lua @@ -1,5 +1,3 @@ -print("Running test for " .. script.Parent.Name) - local function AwaitCondition(predicate, timeout) local start = os.clock() timeout = (timeout or 10) diff --git a/modules/symbol/init.spec.lua b/modules/symbol/init.spec.lua index e706e8ca..63e8b4f5 100644 --- a/modules/symbol/init.spec.lua +++ b/modules/symbol/init.spec.lua @@ -1,5 +1,3 @@ -print("Running test for " .. script.Parent.Name) - return function() local Symbol = require(script.Parent) diff --git a/modules/table-util/init.spec.lua b/modules/table-util/init.spec.lua index 653090a6..357f32de 100644 --- a/modules/table-util/init.spec.lua +++ b/modules/table-util/init.spec.lua @@ -1,5 +1,3 @@ -print("Running test for " .. script.Parent.Name) - return function() local TableUtil = require(script.Parent) diff --git a/modules/timer/init.spec.lua b/modules/timer/init.spec.lua index db9c6581..416a095a 100644 --- a/modules/timer/init.spec.lua +++ b/modules/timer/init.spec.lua @@ -1,5 +1,3 @@ -print("Running test for " .. script.Parent.Name) - return function() local Timer = require(script.Parent) @@ -10,6 +8,7 @@ return function() beforeEach(function() timer = Timer.new(0.1) + timer.TimeFunction = os.clock end) afterEach(function() diff --git a/modules/trove/init.spec.lua b/modules/trove/init.spec.lua index 52b09f27..47049723 100644 --- a/modules/trove/init.spec.lua +++ b/modules/trove/init.spec.lua @@ -1,5 +1,3 @@ -print("Running test for " .. script.Parent.Name) - return function() local Trove = require(script.Parent) diff --git a/test.project.json b/test.project.json new file mode 100644 index 00000000..9c17bb82 --- /dev/null +++ b/test.project.json @@ -0,0 +1,19 @@ +{ + "name": "rbx-util", + "tree": { + "$className": "DataModel", + "ReplicatedStorage": { + "$className": "ReplicatedStorage", + "Test": { + "$path": "test" + } + }, + "TestService": { + "$className": "TestService", + "$path": "ci", + "$properties": { + "ExecuteWithStudioRun": true + } + } + } +}