DeathReportTestUtils
Shared harness for the deathreport specs. DeathReportTestUtils.setup boots DeathReportService the way production does -- through a ServiceBag -- and optionally a second, client-realm bag running DeathReportServiceClient against it over dummy-mode remoting. Real players never join a headless place, so players are PlayerMocks created through the server bag's PlayerMockService, and a character is spawned with PlayerMock.loadMinimalCharacterAsync so DeathTrackedHumanoid discovers it like a real join.
Binders are exposed as resolved by the bags (teamKillTrackerBinder, ...): a ServiceBag
instantiates its own isolated copy of every service it runs, so the module value a spec requires
is never the binder that was started, and binding through it fails.
The test place is shared across a batch run, so every controller derives distinct user ids from a
module-level counter and tears down everything it created via Destroy() -- client bag first, then
the server bag that owns the mocks.
Functions
waitFor
DeathReportTestUtils.waitFor(condition: () → boolean,timeout: number?) → boolean
Polls until the condition passes or the timeout elapses. Returns the final condition result so
specs can expect(...).toBe(true) on it.
awaitBound
Yields until the binder has bound the instance and returns the bound class.
awaitUnbound
Returns once inst is no longer bound. Removal is usually already done by the time we check; the
guarded wait also covers a deferred case.
setup
DeathReportTestUtils.setup(options: {withClient: boolean?}?) → {...}Builds the controller the specs share.
Fields: maid, serverBag, deathReportService, playerMockService, container, the server
binders teamKillTrackerBinder, playerKillTrackerBinder, playerDeathTrackerBinder, and with
withClient: clientBag, deathReportServiceClient, playerMockServiceClient and the client
binders teamKillTrackerClientBinder, playerKillTrackerClientBinder, playerDeathTrackerClientBinder.
Builders: newMock(overrides?) -> Player, newCharacter(mock) -> (Model, Humanoid) bound to
DeathTrackedHumanoid, newNpc(name?) -> (Model, Humanoid) untracked, newTeam(name?, brickColor?)
-> Team.
Actions: setTeam(mock, team?), setLocalPlayer(mock), kill(humanoid, killer?).
Lifecycle: destroyClientBag(), destroyServerBag(), Destroy().