]> git.codecow.com Git - libnemo.git/commitdiff
Fix assertions for expected failures.
authorChris Duncan <chris@zoso.dev>
Sat, 2 Aug 2025 08:53:13 +0000 (01:53 -0700)
committerChris Duncan <chris@zoso.dev>
Sat, 2 Aug 2025 08:53:13 +0000 (01:53 -0700)
test/GLOBALS.mjs

index cb2f9570f5d08ddbd0e08fd769bb0fe22af9a15e..863c60f994e3e516eef99ff0121d45ed2b161eb7 100644 (file)
@@ -228,10 +228,10 @@ export const assert = {
                if (fn instanceof Promise) {
                        try {
                                await fn
-                               throw new Error(msg ?? 'expected async function to reject')
                        } catch (err) {
                                return true
                        }
+                       throw new Error(msg ?? 'expected async function to reject')
                } else {
                        throw new Error(msg ?? 'expected async function')
                }
@@ -260,9 +260,9 @@ export const assert = {
                }
                try {
                        fn()
-                       throw new Error(msg ?? `expected function to throw an exception`)
                } catch (err) {
                        return true
                }
+               throw new Error(msg ?? `expected function to throw an exception`)
        }
 }