test: improve unexpected warning output

This commit is contained in:
Evan You 2020-07-28 00:24:12 -04:00
parent 7e8b26eba8
commit a5e55e28f1

View File

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