Parcourir la source

test: improve unexpected warning output

Evan You il y a 5 ans
Parent
commit
a5e55e28f1
1 fichiers modifiés avec 5 ajouts et 4 suppressions
  1. 5 4
      scripts/setupJestEnv.ts

+ 5 - 4
scripts/setupJestEnv.ts

@@ -80,9 +80,10 @@ afterEach(() => {
     })
   warn.mockRestore()
   if (nonAssertedWarnings.length) {
-    nonAssertedWarnings.forEach(warning => {
-      console.warn(warning)
-    })
-    throw new Error(`test case threw unexpected warnings.`)
+    throw new Error(
+      `test case threw unexpected warnings:\n - ${nonAssertedWarnings.join(
+        '\n - '
+      )}`
+    )
   }
 })