From: Chris Duncan Date: Sat, 25 Apr 2026 23:00:08 +0000 (-0700) Subject: Add JSdoc typing to resolve test. X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=860026592f60109cdc1dad69015929c4847ffc69;p=libnemo.git Add JSdoc typing to resolve test. --- diff --git a/test/GLOBALS.mjs b/test/GLOBALS.mjs index d94c75b..3d02dae 100644 --- a/test/GLOBALS.mjs +++ b/test/GLOBALS.mjs @@ -284,6 +284,11 @@ export class assert { } } + /** + * @param {(Function | Promise)} fn + * @param {string} [msg] + * @returns {Promise} + */ 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')