(
...args: any[]
)
| 354 | for (const method of consoleMethodsToOverrideForStrictMode) { |
| 355 | const originalMethod = targetConsole[method]; |
| 356 | const overrideMethod: (...args: Array<any>) => void = ( |
| 357 | ...args: any[] |
| 358 | ) => { |
| 359 | const settings = hook.settings; |
| 360 | // Something unexpected happened, fallback to just printing the console message. |
| 361 | if (settings == null) { |
| 362 | originalMethod(...args); |
| 363 | return; |
| 364 | } |
| 365 | |
| 366 | if (settings.hideConsoleLogsInStrictMode) { |
| 367 | return; |
| 368 | } |
| 369 | |
| 370 | // Dim the text color of the double logs if we're not hiding them. |
| 371 | // Firefox doesn't support ANSI escape sequences |
| 372 | if (__IS_FIREFOX__) { |
| 373 | originalMethod( |
| 374 | ...formatWithStyles(args, FIREFOX_CONSOLE_DIMMING_COLOR), |
| 375 | ); |
| 376 | } else { |
| 377 | originalMethod( |
| 378 | ANSI_STYLE_DIMMING_TEMPLATE, |
| 379 | ...formatConsoleArguments(...args), |
| 380 | ); |
| 381 | } |
| 382 | }; |
| 383 | |
| 384 | targetConsole[method] = overrideMethod; |
| 385 | unpatchConsoleCallbacks.push(() => { |
nothing calls this directly
no test coverage detected