test: improve expect.toHaveBeenWarned() message

This commit is contained in:
Evan You 2020-08-24 21:23:08 -04:00
parent 59e58cd4a5
commit b742384313

View File

@ -12,7 +12,10 @@ expect.extend({
return { return {
pass: false, pass: false,
message: () => message: () =>
`expected "${received}" to have been warned.\n\nActual messages:\n\n - ${msgs}` `expected "${received}" to have been warned` +
(msgs.length
? `.\n\nActual messages:\n\n - ${msgs}`
: ` but no warning was recorded.`)
} }
} }
}, },