-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.setupAfterEnv.js
More file actions
35 lines (30 loc) · 888 Bytes
/
jest.setupAfterEnv.js
File metadata and controls
35 lines (30 loc) · 888 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
import '@testing-library/jest-dom/extend-expect';
import 'jest-styled-components';
const nodeCrypto = require('crypto');
// eslint-disable-next-line @typescript-eslint/no-empty-function
window.HTMLElement.prototype.scrollIntoView = function () {};
window.crypto = {
getRandomValues(buffer) {
return nodeCrypto.randomFillSync(buffer);
}
};
const originalError = console.error;
const originalWarn = console.warn;
beforeAll(() => {
console.error = (...args) => {
if (/Warning/.test(args[0]) || /React 19/.test(args[0])) {
return;
}
originalError.call(console, ...args);
};
console.warn = (...args) => {
if (/React 19/.test(args[0])) {
return;
}
originalWarn.call(console, ...args);
};
});
afterAll(() => {
console.error = originalError;
console.warn = originalWarn;
});