@quenty/promisemaid 5.19.0 → 5.21.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,16 @@
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
+ # [5.21.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/promisemaid@5.20.0...@quenty/promisemaid@5.21.0) (2026-07-23)
7
+
8
+ ### Features
9
+
10
+ - Add promise tests ([ff0a2a6](https://github.com/Quenty/NevermoreEngine/commit/ff0a2a6f72bcd63dbecf1af0a57870bac62c77ca))
11
+
12
+ # [5.20.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/promisemaid@5.19.0...@quenty/promisemaid@5.20.0) (2026-07-18)
13
+
14
+ **Note:** Version bump only for package @quenty/promisemaid
15
+
6
16
  # [5.19.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/promisemaid@5.18.1...@quenty/promisemaid@5.19.0) (2026-07-18)
7
17
 
8
18
  **Note:** Version bump only for package @quenty/promisemaid
@@ -0,0 +1,10 @@
1
+ {
2
+ "targets": {
3
+ "test": {
4
+ "universeId": 9716264427,
5
+ "placeId": 76943796490766,
6
+ "project": "test/default.project.json",
7
+ "scriptTemplate": "test/scripts/Server/ServerMain.server.lua"
8
+ }
9
+ }
10
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/promisemaid",
3
- "version": "5.19.0",
3
+ "version": "5.21.0",
4
4
  "description": "Utility methods around promises and maids",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -29,11 +29,13 @@
29
29
  ],
30
30
  "dependencies": {
31
31
  "@quenty/loader": "10.11.0",
32
- "@quenty/maid": "3.9.0",
33
- "@quenty/promise": "10.19.0"
32
+ "@quenty/maid": "3.11.0",
33
+ "@quenty/nevermore-test-runner": "1.5.0",
34
+ "@quenty/promise": "10.21.0",
35
+ "@quentystudios/jest-lua": "3.10.0-quenty.2"
34
36
  },
35
37
  "publishConfig": {
36
38
  "access": "public"
37
39
  },
38
- "gitHead": "cbbb89635bfdcbf32f26a40422ac736292917cca"
40
+ "gitHead": "1de37218a2bedb8e3f8614a2e09bba9eddc812da"
39
41
  }
@@ -0,0 +1,96 @@
1
+ --!nonstrict
2
+ --[[
3
+ @class PromiseMaidUtils.spec.lua
4
+ ]]
5
+
6
+ local require = require(script.Parent.loader).load(script)
7
+
8
+ local Jest = require("Jest")
9
+ local Promise = require("Promise")
10
+ local PromiseMaidUtils = require("PromiseMaidUtils")
11
+
12
+ local describe = Jest.Globals.describe
13
+ local expect = Jest.Globals.expect
14
+ local it = Jest.Globals.it
15
+
16
+ describe("PromiseMaidUtils.whilePromise", function()
17
+ it("invokes the callback with a maid while the promise is pending", function()
18
+ local promise = Promise.new()
19
+ local received = { maid = nil }
20
+
21
+ PromiseMaidUtils.whilePromise(promise, function(maid)
22
+ received.maid = maid
23
+ end)
24
+
25
+ expect(received.maid).never.toEqual(nil)
26
+
27
+ promise:Resolve()
28
+ end)
29
+
30
+ it("cleans up the maid when the promise settles", function()
31
+ local promise = Promise.new()
32
+ local cleaned = { value = false }
33
+
34
+ PromiseMaidUtils.whilePromise(promise, function(maid)
35
+ maid:GiveTask(function()
36
+ cleaned.value = true
37
+ end)
38
+ end)
39
+
40
+ expect(cleaned.value).toEqual(false)
41
+
42
+ promise:Resolve()
43
+ expect(cleaned.value).toEqual(true)
44
+ end)
45
+
46
+ it("cleans up the maid when the promise rejects", function()
47
+ local promise = Promise.new()
48
+ promise:Catch(function() end)
49
+ local cleaned = { value = false }
50
+
51
+ PromiseMaidUtils.whilePromise(promise, function(maid)
52
+ maid:GiveTask(function()
53
+ cleaned.value = true
54
+ end)
55
+ end)
56
+
57
+ promise:Reject("boom")
58
+ expect(cleaned.value).toEqual(true)
59
+ end)
60
+
61
+ it("does not invoke the callback when the promise is already settled", function()
62
+ local called = { value = false }
63
+
64
+ PromiseMaidUtils.whilePromise(Promise.resolved(), function()
65
+ called.value = true
66
+ end)
67
+
68
+ expect(called.value).toEqual(false)
69
+ end)
70
+
71
+ it("cleans up immediately when the callback resolves the promise synchronously", function()
72
+ local promise = Promise.new()
73
+ local cleaned = { value = false }
74
+
75
+ PromiseMaidUtils.whilePromise(promise, function(maid)
76
+ maid:GiveTask(function()
77
+ cleaned.value = true
78
+ end)
79
+ promise:Resolve()
80
+ end)
81
+
82
+ expect(cleaned.value).toEqual(true)
83
+ end)
84
+
85
+ it("throws when given something that is not a promise", function()
86
+ expect(function()
87
+ PromiseMaidUtils.whilePromise(nil, function() end)
88
+ end).toThrow()
89
+ end)
90
+
91
+ it("throws when the callback is not a function", function()
92
+ expect(function()
93
+ PromiseMaidUtils.whilePromise(Promise.new(), nil)
94
+ end).toThrow()
95
+ end)
96
+ end)
@@ -0,0 +1,3 @@
1
+ return {
2
+ testMatch = { "**/*.spec" },
3
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "PromiseMaidTest",
3
+ "globIgnorePaths": [
4
+ "**/.package-lock.json",
5
+ "**/.pnpm",
6
+ "**/.pnpm-workspace-state-v1.json",
7
+ "**/.modules.yaml",
8
+ "**/.ignored",
9
+ "**/.ignored_*"
10
+ ],
11
+ "tree": {
12
+ "$className": "DataModel",
13
+ "ServerScriptService": {
14
+ "$properties": {
15
+ "LoadStringEnabled": true
16
+ },
17
+ "promisemaid": {
18
+ "$path": ".."
19
+ },
20
+ "Script": {
21
+ "$path": "scripts/Server"
22
+ }
23
+ }
24
+ }
25
+ }
@@ -0,0 +1,14 @@
1
+ --!nonstrict
2
+ --[[
3
+ @class ServerMain
4
+ ]]
5
+
6
+ local ServerScriptService = game:GetService("ServerScriptService")
7
+
8
+ local root = ServerScriptService.promisemaid
9
+ local loader = root:FindFirstChild("LoaderUtils", true).Parent
10
+ local require = require(loader).bootstrapGame(root)
11
+
12
+ local NevermoreTestRunnerUtils = require("NevermoreTestRunnerUtils")
13
+
14
+ NevermoreTestRunnerUtils.runTestsIfNeededAsync(root)