Skip to content

Commit

Permalink
test: improve expect.toHaveBeenWarned() message
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Aug 25, 2020
1 parent 59e58cd commit b742384
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion scripts/setupJestEnv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ expect.extend({
return {
pass: false,
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.`)
}
}
},
Expand Down

0 comments on commit b742384

Please sign in to comment.