diff --git a/gmod-addon/lua/autorun/sh_jestronaut.lua b/gmod-addon/lua/autorun/sh_jestronaut.lua index c27106f..adad81f 100644 --- a/gmod-addon/lua/autorun/sh_jestronaut.lua +++ b/gmod-addon/lua/autorun/sh_jestronaut.lua @@ -1,3 +1,25 @@ +AddCSLuaFile() +AddCSLuaFile("sh_jestronaut_gmod_reporter.lua") +AddCSLuaFile("sh_jestronaut_gmod_test.lua") +AddCSLuaFile("jestronaut.lua") + +--- Recursively adds all files in a directory to be included by AddCSLuaFile +--- @param path string +local function addDirectory(path) + local files, directories = file.Find(path .. "/*", "LUA") + + for _, file in ipairs(files) do + AddCSLuaFile(path .. "/" .. file) + end + + for _, directory in ipairs(directories) do + addDirectory(path .. "/" .. directory) + end +end + +addDirectory("jestronaut") +addDirectory("tests") + -- Gmod's require doesn't return any values, so we replace require with include while loading jestronaut -- This is a hacky way to make jestronaut work with Gmod local function callWithRequireCompat(func) @@ -11,7 +33,7 @@ local function callWithRequireCompat(func) if (file.Exists(path .. ".lua", "LUA")) then alreadyRequired[path] = { include(path .. ".lua") } else - Msg("Could not find file: " .. path) + MsgN("Could not find file: " .. path) return false end end