@quenty/playerutils 8.42.0 → 8.43.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,10 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [8.43.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/playerutils@8.42.0...@quenty/playerutils@8.43.0) (2026-08-28)
7
+
8
+ **Note:** Version bump only for package @quenty/playerutils
9
+
6
10
  # [8.42.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/playerutils@8.41.1...@quenty/playerutils@8.42.0) (2026-08-28)
7
11
 
8
12
  **Note:** Version bump only for package @quenty/playerutils
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/playerutils",
3
- "version": "8.42.0",
3
+ "version": "8.43.0",
4
4
  "description": "Player utility functions",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -31,16 +31,17 @@
31
31
  "access": "public"
32
32
  },
33
33
  "dependencies": {
34
- "@quenty/brio": "14.36.0",
35
- "@quenty/characterutils": "12.42.0",
36
- "@quenty/instanceutils": "13.36.0",
34
+ "@quenty/brio": "14.37.0",
35
+ "@quenty/characterutils": "12.43.0",
36
+ "@quenty/instanceutils": "13.37.0",
37
+ "@quenty/jestutils": "1.1.0",
37
38
  "@quenty/loader": "10.11.1",
38
39
  "@quenty/maid": "3.12.0",
39
40
  "@quenty/nevermore-test-runner": "1.6.0",
40
- "@quenty/playermock": "1.7.0",
41
+ "@quenty/playermock": "1.8.0",
41
42
  "@quenty/promise": "10.24.0",
42
43
  "@quenty/rx": "13.34.0",
43
44
  "@quentystudios/jest-lua": "3.10.0-quenty.2"
44
45
  },
45
- "gitHead": "f75f93d5b2ac51cf7da3b7599788dcce31fd8a29"
46
+ "gitHead": "346201e192e467cb71160f43029863853be855b5"
46
47
  }
@@ -4,6 +4,7 @@ local require = require(script.Parent.loader).load(script)
4
4
  local Players = game:GetService("Players")
5
5
 
6
6
  local Jest = require("Jest")
7
+ local JestUtils = require("JestUtils")
7
8
  local Maid = require("Maid")
8
9
  local PlayerMock = require("PlayerMock")
9
10
  local PlayerUtils = require("PlayerUtils")
@@ -23,11 +24,13 @@ local function setup(): any
23
24
  maid:GiveTask(player)
24
25
  return player
25
26
  end,
26
- destroy = function()
27
+ Destroy = function(_self)
27
28
  maid:DoCleaning()
28
29
  end,
29
30
  }
30
31
 
32
+ maid:GiveTask(JestUtils.afterThis(controller))
33
+
31
34
  return controller
32
35
  end
33
36
 
@@ -86,7 +89,7 @@ describe("PlayerUtils.formatName", function()
86
89
  local player = controller.newPlayer({ UserId = 8675309 })
87
90
  expect(PlayerUtils.formatName(player)).toBe(player.Name)
88
91
 
89
- controller.destroy()
92
+ controller:Destroy()
90
93
  end)
91
94
 
92
95
  it("qualifies the mock's display name stand-in with its name", function()
@@ -95,7 +98,7 @@ describe("PlayerUtils.formatName", function()
95
98
  local player = controller.newPlayer({ UserId = 8675309, DisplayName = "oot" })
96
99
  expect(PlayerUtils.formatName(player)).toBe(string.format("oot (@%s)", player.Name))
97
100
 
98
- controller.destroy()
101
+ controller:Destroy()
99
102
  end)
100
103
 
101
104
  it("follows a display name written mid-test", function()
@@ -105,7 +108,7 @@ describe("PlayerUtils.formatName", function()
105
108
  PlayerMock.write(player, "DisplayName", "oot")
106
109
  expect(PlayerUtils.formatName(player)).toBe(string.format("oot (@%s)", player.Name))
107
110
 
108
- controller.destroy()
111
+ controller:Destroy()
109
112
  end)
110
113
 
111
114
  it("rejects an instance that is neither a Player nor a mock", function()
@@ -126,7 +129,7 @@ describe("PlayerUtils.promiseLoadCharacter", function()
126
129
  expect(character).toBe(PlayerMock.read(player, "Character"))
127
130
  expect(character.Parent).toBe(workspace)
128
131
 
129
- controller.destroy()
132
+ controller:Destroy()
130
133
  end)
131
134
 
132
135
  it("rejects an instance that is neither a Player nor a mock", function()
@@ -153,7 +156,7 @@ describe("PlayerUtils.promiseLoadCharacterWithHumanoidDescription", function()
153
156
  expect(character:FindFirstChildOfClass("Humanoid")).never.toBeNil()
154
157
 
155
158
  description:Destroy()
156
- controller.destroy()
159
+ controller:Destroy()
157
160
  end)
158
161
 
159
162
  it("rejects a bad humanoidDescription", function()
@@ -164,6 +167,6 @@ describe("PlayerUtils.promiseLoadCharacterWithHumanoidDescription", function()
164
167
  PlayerUtils.promiseLoadCharacterWithHumanoidDescription(player, Instance.new("Folder") :: any)
165
168
  end).toThrow()
166
169
 
167
- controller.destroy()
170
+ controller:Destroy()
168
171
  end)
169
172
  end)
@@ -4,6 +4,7 @@ local require = require(script.Parent.loader).load(script)
4
4
  local Players = game:GetService("Players")
5
5
 
6
6
  local Jest = require("Jest")
7
+ local JestUtils = require("JestUtils")
7
8
  local Maid = require("Maid")
8
9
  local PlayerMock = require("PlayerMock")
9
10
  local PromiseTestUtils = require("PromiseTestUtils")
@@ -43,12 +44,7 @@ local function setup(): any
43
44
  return player
44
45
  end,
45
46
  designateLocalPlayer = function(player: Player?)
46
- PlayerMock.setMockedLocalPlayer(player)
47
- maid:GiveTask(function()
48
- if player ~= nil and PlayerMock.getMockedLocalPlayer() == player then
49
- PlayerMock.setMockedLocalPlayer(nil)
50
- end
51
- end)
47
+ maid:GiveTask(PlayerMock.setMockedLocalPlayer(player))
52
48
  end,
53
49
  record = function(observable: any): { any }
54
50
  local values = {}
@@ -62,11 +58,13 @@ local function setup(): any
62
58
  return #values >= count
63
59
  end)
64
60
  end,
65
- destroy = function()
61
+ Destroy = function(_self)
66
62
  maid:DoCleaning()
67
63
  end,
68
64
  }
69
65
 
66
+ maid:GiveTask(JestUtils.afterThis(controller))
67
+
70
68
  return controller
71
69
  end
72
70
 
@@ -80,7 +78,7 @@ describe("RxPlayerUtils.observePlayers", function()
80
78
  expect(controller.awaitCount(players, 1)).toBe(true)
81
79
  expect(contains(players, player)).toBe(true)
82
80
 
83
- controller.destroy()
81
+ controller:Destroy()
84
82
  end)
85
83
 
86
84
  it("emits a mock that joins after subscribing", function()
@@ -92,7 +90,7 @@ describe("RxPlayerUtils.observePlayers", function()
92
90
  expect(controller.awaitCount(players, 1)).toBe(true)
93
91
  expect(contains(players, player)).toBe(true)
94
92
 
95
- controller.destroy()
93
+ controller:Destroy()
96
94
  end)
97
95
 
98
96
  it("skips mocks the predicate rejects", function()
@@ -106,7 +104,7 @@ describe("RxPlayerUtils.observePlayers", function()
106
104
  expect(contains(players, accepted)).toBe(true)
107
105
  expect(contains(players, rejected)).toBe(false)
108
106
 
109
- controller.destroy()
107
+ controller:Destroy()
110
108
  end)
111
109
  end)
112
110
 
@@ -120,7 +118,7 @@ describe("RxPlayerUtils.observePlayersBrio", function()
120
118
  expect(controller.awaitCount(brios, 1)).toBe(true)
121
119
  expect(findLivingBrio(brios, player)).never.toBeNil()
122
120
 
123
- controller.destroy()
121
+ controller:Destroy()
124
122
  end)
125
123
 
126
124
  it("emits a living brio for a mock that joins after subscribing", function()
@@ -132,7 +130,7 @@ describe("RxPlayerUtils.observePlayersBrio", function()
132
130
  expect(controller.awaitCount(brios, 1)).toBe(true)
133
131
  expect(findLivingBrio(brios, player)).never.toBeNil()
134
132
 
135
- controller.destroy()
133
+ controller:Destroy()
136
134
  end)
137
135
 
138
136
  it("kills the brio when the mock is destroyed", function()
@@ -149,7 +147,7 @@ describe("RxPlayerUtils.observePlayersBrio", function()
149
147
  return brio:IsDead()
150
148
  end)).toBe(true)
151
149
 
152
- controller.destroy()
150
+ controller:Destroy()
153
151
  end)
154
152
 
155
153
  it("kills the brio when the mock is kicked", function()
@@ -167,7 +165,7 @@ describe("RxPlayerUtils.observePlayersBrio", function()
167
165
  return brio:IsDead()
168
166
  end)).toBe(true)
169
167
 
170
- controller.destroy()
168
+ controller:Destroy()
171
169
  end)
172
170
 
173
171
  it("skips mocks the predicate rejects", function()
@@ -180,7 +178,7 @@ describe("RxPlayerUtils.observePlayersBrio", function()
180
178
  expect(controller.awaitCount(brios, 1)).toBe(true)
181
179
  expect(findLivingBrio(brios, rejected)).toBeNil()
182
180
 
183
- controller.destroy()
181
+ controller:Destroy()
184
182
  end)
185
183
  end)
186
184
 
@@ -195,7 +193,7 @@ describe("RxPlayerUtils.observeCharactersBrio", function()
195
193
  expect(controller.awaitCount(brios, 1)).toBe(true)
196
194
  expect(findLivingBrio(brios, character)).never.toBeNil()
197
195
 
198
- controller.destroy()
196
+ controller:Destroy()
199
197
  end)
200
198
 
201
199
  it("kills the brio when the character despawns", function()
@@ -213,7 +211,7 @@ describe("RxPlayerUtils.observeCharactersBrio", function()
213
211
  return brio:IsDead()
214
212
  end)).toBe(true)
215
213
 
216
- controller.destroy()
214
+ controller:Destroy()
217
215
  end)
218
216
  end)
219
217
 
@@ -228,7 +226,7 @@ describe("RxPlayerUtils.observeHumanoidsBrio", function()
228
226
  expect(controller.awaitCount(brios, 1)).toBe(true)
229
227
  expect(findLivingBrio(brios, character:FindFirstChildOfClass("Humanoid"))).never.toBeNil()
230
228
 
231
- controller.destroy()
229
+ controller:Destroy()
232
230
  end)
233
231
  end)
234
232
 
@@ -241,7 +239,7 @@ describe("RxPlayerUtils.observeLocalPlayerBrio", function()
241
239
 
242
240
  expect(#brios).toBe(0)
243
241
 
244
- controller.destroy()
242
+ controller:Destroy()
245
243
  end)
246
244
 
247
245
  it("emits a living brio for a mock designated before subscribing", function()
@@ -254,7 +252,7 @@ describe("RxPlayerUtils.observeLocalPlayerBrio", function()
254
252
  expect(controller.awaitCount(brios, 1)).toBe(true)
255
253
  expect(brios[1]:GetValue()).toBe(player)
256
254
 
257
- controller.destroy()
255
+ controller:Destroy()
258
256
  end)
259
257
 
260
258
  it("emits a living brio for a mock designated after subscribing", function()
@@ -267,7 +265,7 @@ describe("RxPlayerUtils.observeLocalPlayerBrio", function()
267
265
  expect(controller.awaitCount(brios, 1)).toBe(true)
268
266
  expect(brios[1]:GetValue()).toBe(player)
269
267
 
270
- controller.destroy()
268
+ controller:Destroy()
271
269
  end)
272
270
 
273
271
  it("kills the brio when the designation is cleared", function()
@@ -284,7 +282,7 @@ describe("RxPlayerUtils.observeLocalPlayerBrio", function()
284
282
  return brios[1]:IsDead()
285
283
  end)).toBe(true)
286
284
 
287
- controller.destroy()
285
+ controller:Destroy()
288
286
  end)
289
287
  end)
290
288
 
@@ -300,7 +298,7 @@ describe("RxPlayerUtils.observeLocalPlayerHumanoidBrio", function()
300
298
  expect(controller.awaitCount(brios, 1)).toBe(true)
301
299
  expect(findLivingBrio(brios, character:FindFirstChildOfClass("Humanoid"))).never.toBeNil()
302
300
 
303
- controller.destroy()
301
+ controller:Destroy()
304
302
  end)
305
303
  end)
306
304
 
@@ -313,7 +311,7 @@ describe("RxPlayerUtils.observeFirstAppearanceLoaded", function()
313
311
 
314
312
  expect(#fires).toBe(0)
315
313
 
316
- controller.destroy()
314
+ controller:Destroy()
317
315
  end)
318
316
 
319
317
  it("fires once the mock spawns", function()
@@ -340,7 +338,7 @@ describe("RxPlayerUtils.observeFirstAppearanceLoaded", function()
340
338
  end)).toBe(true)
341
339
 
342
340
  maid:DoCleaning()
343
- controller.destroy()
341
+ controller:Destroy()
344
342
  end)
345
343
 
346
344
  it("fires immediately when the mock has already spawned", function()
@@ -366,7 +364,7 @@ describe("RxPlayerUtils.observeFirstAppearanceLoaded", function()
366
364
  expect(completed).toBe(true)
367
365
 
368
366
  maid:DoCleaning()
369
- controller.destroy()
367
+ controller:Destroy()
370
368
  end)
371
369
 
372
370
  it("fails when the mock leaves before spawning", function()
@@ -386,6 +384,6 @@ describe("RxPlayerUtils.observeFirstAppearanceLoaded", function()
386
384
  end)).toBe(true)
387
385
 
388
386
  maid:DoCleaning()
389
- controller.destroy()
387
+ controller:Destroy()
390
388
  end)
391
389
  end)