Skip to content

AGameTestModFilter

Restricts which AGametestEvents.REGISTER_GAME_TEST-registered mods a single runGametest/ runGametestClient invocation actually runs, via the GAMETEST_MOD_ID_FILTER_PROPERTY system property (a comma-separated list of mod ids).

Every mod that has called AGametestEvents += MOD (in archie-gametest) shares one JVM-wide MODS list - which matters because a composite build's included builds can both end up in that list within the same process. Archie-Test's Loom runs{} blocks includeBuild("../Archie"), and both Archie and ArchieTest's mod init call AGametestEvents += MOD, so launching Archie-Test's own runGametestClient/runGametest previously ran Archie's entire GameTest suite a second time in the same process, without Archie-Test's own suite being any bigger - only distinguishable by the test count not matching the log's actual line count. Every loader's AGameTestRegistrationBridge/ AClientGameTestHarness server- and client-side test collection should call selectMods on AGametestEvents.MODS before iterating, instead of iterating it directly.

Functions

selectMods

fun selectMods(mods: Collection<Mod>): List<Mod>

Filters mods down to just the ones named in GAMETEST_MOD_ID_FILTER_PROPERTY, or returns mods unchanged if that property isn't set. Each project's own Loom runs{} block should set this to its own mod_id gradle property on its gametest/gametestClient runs.

Throws

IllegalStateException

if the property is set but names no mod present in mods.