(this: typeof console)
| 388 | 'name', |
| 389 | ); |
| 390 | const wrapperMethod = function (this: typeof console) { |
| 391 | const request = resolveRequest(); |
| 392 | if (methodName === 'assert' && arguments[0]) { |
| 393 | // assert doesn't emit anything unless first argument is falsy so we can skip it. |
| 394 | } else if (request !== null) { |
| 395 | // Extract the stack. Not all console logs print the full stack but they have at |
| 396 | // least the line it was called from. We could optimize transfer by keeping just |
| 397 | // one stack frame but keeping it simple for now and include all frames. |
| 398 | const stack = filterStackTrace( |
| 399 | request, |
| 400 | parseStackTracePrivate(new Error('react-stack-top-frame'), 1) || [], |
| 401 | ); |
| 402 | request.pendingDebugChunks++; |
| 403 | const owner: null | ReactComponentInfo = resolveOwner(); |
| 404 | const args = Array.from(arguments); |
| 405 | // Extract the env if this is a console log that was replayed from another env. |
| 406 | let env = unbadgeConsole(methodName, args); |
| 407 | if (env === null) { |
| 408 | // Otherwise add the current environment. |
| 409 | env = (0, request.environmentName)(); |
| 410 | } |
| 411 | |
| 412 | emitConsoleChunk(request, methodName, owner, env, stack, args); |
| 413 | } |
| 414 | // $FlowFixMe[incompatible-call] |
| 415 | return originalMethod.apply(this, arguments); |
| 416 | }; |
| 417 | if (originalName) { |
| 418 | Object.defineProperty( |
| 419 | wrapperMethod, |
nothing calls this directly
no test coverage detected