Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions lua/gluatest/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,22 @@ GLuaTest = {
--- @diagnostic disable-next-line: param-type-mismatch
SelfTestConVar = CreateConVar( "gluatest_selftest_enable", "0", conVarFlags, "Should GLuaTest run its own tests?" ),

--- @type GLuaTest_Loader
Loader = include( "gluatest/loader.lua" ),

DeprecatedNotice = function( old, new )
local msg = [[GLuaTest: (DEPRECATION NOTICE) "]] .. old .. [[" is deprecated, use "]] .. new .. [[" instead.]]
if SERVER then MsgC( RED, msg .. "\n" ) end
end
}

--[[ Extensions ]] do

-- Because extensions do their own AddCSLuaFile calls, we need to load them immediately so local server clients receive them
GLuaTest.Loader.loadExtensions( "gluatest/extensions" )
end
--[[ Set Up Client Testing ]] do

if SERVER then
util.AddNetworkString( "GLuaTest_RunClientTests" )

Expand Down Expand Up @@ -125,11 +134,10 @@ GLuaTest.runAllTests = function()
return
end

GLuaTest.VERSION = VersionTools.getVersion()
-- Re-load extensions to make extension development easier
GLuaTest.Loader.loadExtensions( "gluatest/extensions" )

--- @type GLuaTest_Loader
local Loader = include( "gluatest/loader.lua" )
Loader.loadExtensions( "gluatest/extensions" )
GLuaTest.VERSION = VersionTools.getVersion()

local testPaths = {
"tests",
Expand All @@ -142,7 +150,7 @@ GLuaTest.runAllTests = function()

for i = 1, #testPaths do
local path = testPaths[i]
loadAllProjectsFrom( Loader, path, testFiles )
loadAllProjectsFrom( GLuaTest.Loader, path, testFiles )
end

hook.Run( "GLuaTest_RunTestFiles", testFiles )
Expand Down
12 changes: 10 additions & 2 deletions lua/gluatest/runner/logger.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,18 @@ local ResultLogger = {}


function ResultLogger.prefixLog( ... )
local prefixColor = SERVER and colors.server or colors.client
local prefixColor
local prefixText = "GLuaTest"
if SERVER then
prefixText = "sv_" .. prefixText
prefixColor = colors.server
else
prefixText = "cl_" .. prefixText
prefixColor = colors.client
end
Comment on lines +18 to +24

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't love this.

Could we maybe only prefix them if the clientside convar is enabled, or similar? Or, perhaps, only prefix the client tests?


MsgC( colors.darkgrey, "[" )
MsgC( prefixColor, "GLuaTest" )
MsgC( prefixColor, prefixText )
MsgC( colors.darkgrey, "] " )
MsgC( ... )
end
Expand Down