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()
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 - '
)}`
)
}
})