| 44 | const WARNING_PATTERNS_WE_SHOULD_FIX_BUT_ALLOW = ['Browserslist: caniuse-lite is outdated']; |
| 45 | |
| 46 | function failTestOnConsoleError() { |
| 47 | const error = console.error; |
| 48 | |
| 49 | console.error = function (message) { |
| 50 | const allowedPattern = |
| 51 | typeof message === 'string' && |
| 52 | ERROR_PATTERNS_WE_SHOULD_FIX_BUT_ALLOW.find(pattern => message.indexOf(pattern) > -1); |
| 53 | if (allowedPattern) { |
| 54 | return; |
| 55 | } |
| 56 | |
| 57 | error.apply(console, arguments); |
| 58 | throw message instanceof Error ? message : new Error(message); |
| 59 | }; |
| 60 | } |
| 61 | |
| 62 | function failTestOnConsoleWarn() { |
| 63 | const warn = console.warn; |