MCPcopy Index your code
hub / github.com/react/react / App

Function App

packages/react-devtools-shared/src/__tests__/console-test.js:372–404  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

370 const root = ReactDOMClient.createRoot(container);
371
372 function App() {
373 console.log('log');
374 console.warn('warn');
375 console.error('error');
376 return <div />;
377 }
378
379 act(() =>
380 root.render(
381 <React.StrictMode>
382 <App />
383 </React.StrictMode>,
384 ),
385 );
386
387 expect(global.consoleLogMock).toHaveBeenCalledTimes(2);
388 expect(global.consoleLogMock.mock.calls[1]).toEqual([
389 '\x1b[2;38;2;124;124;124m%s\x1b[0m',
390 'log',
391 ]);
392
393 expect(global.consoleWarnMock).toHaveBeenCalledTimes(2);
394 expect(global.consoleWarnMock.mock.calls[1]).toEqual([
395 '\x1b[2;38;2;124;124;124m%s\x1b[0m',
396 'warn',
397 ]);
398
399 expect(global.consoleErrorMock).toHaveBeenCalledTimes(2);
400 expect(global.consoleErrorMock.mock.calls[1]).toEqual([
401 '\x1b[2;38;2;124;124;124m%s\x1b[0m',
402 'error',
403 ]);
404 });
405
406 it('should not double log if hideConsoleLogsInStrictMode is enabled in Strict mode', () => {
407 global.__REACT_DEVTOOLS_GLOBAL_HOOK__.settings.appendComponentStack = false;

Callers

nothing calls this directly

Calls 5

toHaveBeenCalledTimesMethod · 0.80
actFunction · 0.70
errorMethod · 0.65
renderMethod · 0.65
toEqualMethod · 0.65

Tested by

no test coverage detected