]> git.codecow.com Git - libnemo.git/commitdiff
Add JSdoc typing to resolve test.
authorChris Duncan <chris@zoso.dev>
Sat, 25 Apr 2026 23:00:08 +0000 (16:00 -0700)
committerChris Duncan <chris@zoso.dev>
Sat, 25 Apr 2026 23:00:08 +0000 (16:00 -0700)
test/GLOBALS.mjs

index d94c75b97ac9c019b9af033332ffd990b50ce6b7..3d02daee2759a14325bc1e88a5ff7367698ec040 100644 (file)
@@ -284,6 +284,11 @@ export class assert {
                }
        }
 
+       /**
+        * @param {(Function | Promise<any>)} fn
+        * @param {string} [msg]
+        * @returns {Promise<void>}
+        */
        static async resolves (fn, msg) {
                if (fn.constructor.name === 'AsyncFunction') {
                        fn = fn()
@@ -292,7 +297,7 @@ export class assert {
                        try {
                                await fn
                        } catch (err) {
-                               throw new Error(msg ?? 'expected async function to resolve')
+                               throw new Error(err?.message ?? msg ?? 'expected async function to resolve')
                        }
                } else {
                        throw new Error('expected async function')