-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Expand file tree
/
Copy pathjest.setup.js
More file actions
37 lines (31 loc) · 1003 Bytes
/
jest.setup.js
File metadata and controls
37 lines (31 loc) · 1003 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// eslint-disable-next-line import/no-extraneous-dependencies
import 'jest-styled-components';
import 'regenerator-runtime/runtime';
// See: https://github.com/testing-library/jest-dom
// eslint-disable-next-line import/no-extraneous-dependencies
import '@testing-library/jest-dom';
const originalConsoleError = console.error;
const originalConsoleWarn = console.warn;
console.error = (...args) => {
// Use .join() to check the entire message content regardless of how React formats it
const fullMessage = args.join(' ');
if (
fullMessage.includes(
'The prop `component` is marked as required in `Route`'
)
) {
return;
}
originalConsoleError.apply(console, args);
};
console.warn = (...args) => {
const fullMessage = args.join(' ');
if (
fullMessage.includes('has been renamed') ||
fullMessage.includes('SideEffect(NullComponent)') ||
fullMessage.includes('Duplicate schema index')
) {
return;
}
originalConsoleWarn.apply(console, args);
};