start testing

This commit is contained in:
Michael Freno
2025-11-14 20:59:40 -05:00
parent a218b4abed
commit 1dab1a197e
18 changed files with 4886 additions and 11 deletions

View File

@@ -1,25 +1,48 @@
package.path = package.path .. ";./?.lua;./game/?.lua;./game/utils/?.lua;./game/components/?.lua;./game/systems/?.lua"
-- Enable code coverage tracking BEFORE loading any modules
local coverage_enabled = os.getenv("COVERAGE") == "1"
if coverage_enabled then
local status, luacov = pcall(require, "luacov")
if status then
print("========================================")
print("Code coverage tracking enabled")
print("========================================")
else
print("Warning: luacov not found, coverage tracking disabled")
end
end
-- Set global flag to prevent individual test files from running luaunit
_G.RUNNING_ALL_TESTS = true
local luaunit = require("testing.luaunit")
-- Run all tests in the __tests__ directory
local testFiles = {}
local testFiles = {
"testing/__tests__/utils_test.lua",
"testing/__tests__/sanitization_test.lua",
"testing/__tests__/path_validation_test.lua",
"testing/__tests__/color_validation_test.lua",
"testing/__tests__/texteditor_sanitization_test.lua",
"testing/__tests__/theme_validation_test.lua",
"testing/__tests__/units_test.lua",
}
local success = true
print("========================================")
print("Running ALL tests")
print("========================================")
for _, testFile in ipairs(testFiles) do
for i, testFile in ipairs(testFiles) do
print("========================================")
print("Running test file: " .. testFile)
print("Running test file " .. i .. "/" .. #testFiles .. ": " .. testFile)
print("========================================")
local status, err = pcall(dofile, testFile)
if not status then
print("Error running test " .. testFile .. ": " .. tostring(err))
print("ERROR running test " .. testFile .. ": " .. tostring(err))
success = false
else
print("Successfully loaded " .. testFile)
end
end