(format, ...args)
| 30 | |
| 31 | const patchConsoleMethod = (methodName, unexpectedConsoleCallStacks) => { |
| 32 | const newMethod = function (format, ...args) { |
| 33 | // Ignore uncaught errors reported by jsdom |
| 34 | // and React addendums because they're too noisy. |
| 35 | if (methodName === 'error' && shouldIgnoreConsoleError(format, args)) { |
| 36 | return |
| 37 | } |
| 38 | |
| 39 | // Capture the call stack now so we can warn about it later. |
| 40 | // The call stack has helpful information for the test author. |
| 41 | // Don't throw yet though b'c it might be accidentally caught and suppressed. |
| 42 | const stack = new Error().stack |
| 43 | unexpectedConsoleCallStacks.push([ |
| 44 | stack.substr(stack.indexOf('\n') + 1), |
| 45 | util.format(format, ...args), |
| 46 | ]) |
| 47 | } |
| 48 | |
| 49 | console[methodName] = newMethod |
| 50 |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…