* This monkey-patches `window.console.error` in order to fail a test if that * function is called within a test. * * @returns a teardown function which ondoes the monkey-patch
()
| 40 | * @returns a teardown function which ondoes the monkey-patch |
| 41 | */ |
| 42 | function patchConsoleError() { |
| 43 | const orgConsoleError = window.console.error; |
| 44 | |
| 45 | window.console.error = function (...args: any[]) { |
| 46 | orgConsoleError.apply(window, args); |
| 47 | window.console.info('console.error', args); |
| 48 | throw new Error('console.error was called, this is not allowed in a unit test run'); |
| 49 | }; |
| 50 | |
| 51 | return () => { |
| 52 | window.console.error = orgConsoleError; |
| 53 | }; |
| 54 | } |
| 55 | |
| 56 | describe('prerender', () => { |
| 57 | let iframe: HTMLElement; |