• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

spautz / react-hibernate / 4089579833

pending completion
4089579833

push

github

GitHub
build(deps): bump http-cache-semantics from 4.1.0 to 4.1.1

49 of 120 branches covered (40.83%)

Branch coverage included in aggregate %.

150 of 432 relevant lines covered (34.72%)

8.99 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/packages/dev-helpers/src/jest/suppressReactDevErrors.ts
1
/* global console */
2

3
// Something about the portal usage, combined with react being a direct devDependency, leads to these errors
4
// appearing *between* tests. They don't occur when the library runs normally.
5
let originalConsoleError: null | typeof console.error;
6

7
const suppressReactUnmountErrors = (): void => {
×
8
  const errorMessagesToSuppress = [
×
9
    "Warning: unmountComponentAtNode(): The node you're attempting to unmount was rendered by another copy of React.",
10
    'Warning: render(...): It looks like the React-rendered content of this container was removed without using React. This is not supported and will cause errors. Instead, call ReactDOM.unmountComponentAtNode to empty a container.',
11
  ];
12

13
  if (originalConsoleError) {
×
14
    throw new Error('console.error cannot be replaced: it has already been replaced');
×
15
  }
16

17
  originalConsoleError = console.error;
×
18
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
19
  console.error = (message?: any, ...optionalParams: any[]): void => {
×
20
    if (errorMessagesToSuppress.includes(message)) {
×
21
      return;
×
22
    }
23
    // Else: pass it through
24
    if (originalConsoleError) {
×
25
      originalConsoleError(message, ...optionalParams);
×
26
    } else {
27
      throw new Error('console.error is replaced, but originalConsoleError is not available');
×
28
    }
29
  };
30
};
31

32
const restoreReactUnmountErrors = (): void => {
×
33
  if (originalConsoleError) {
×
34
    console.error = originalConsoleError;
×
35
    originalConsoleError = null;
×
36
  }
37
};
38

39
export { suppressReactUnmountErrors, restoreReactUnmountErrors };
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc