2020-12-03 13:07:58 +08:00
|
|
|
const originalWarn = console.warn.bind(console.warn);
|
2022-04-12 14:22:39 +08:00
|
|
|
require('@testing-library/jest-dom');
|
2021-03-17 10:26:41 +08:00
|
|
|
require('moment-timezone');
|
|
|
|
const moment = require('moment');
|
|
|
|
moment.tz.setDefault('Asia/Shanghai');
|
2022-06-01 15:06:00 +08:00
|
|
|
const cleanup = require('@testing-library/react').cleanup;
|
2021-03-17 10:26:41 +08:00
|
|
|
|
2022-06-02 10:00:09 +08:00
|
|
|
// https://github.com/nrwl/nx/issues/1178
|
|
|
|
// 解决jest 运行的时候报:
|
|
|
|
// ReferenceError: DragEvent is not defined
|
|
|
|
Object.defineProperty(window, 'DragEvent', {
|
|
|
|
value: class DragEvent {}
|
|
|
|
});
|
|
|
|
|
2022-10-31 20:53:36 +08:00
|
|
|
global.__buildVersion = '';
|
|
|
|
|
2020-12-03 13:07:58 +08:00
|
|
|
global.beforeAll(() => {
|
|
|
|
console.warn = msg => {
|
|
|
|
// warning 先关了,实在太吵。
|
|
|
|
// const str = msg.toString();
|
|
|
|
// if (
|
|
|
|
// str.includes('componentWillMount') ||
|
|
|
|
// str.includes('componentWillReceiveProps')
|
|
|
|
// ) {
|
|
|
|
// return;
|
|
|
|
// }
|
|
|
|
// originalWarn(msg);
|
|
|
|
};
|
|
|
|
});
|
|
|
|
global.afterAll(() => {
|
|
|
|
console.warn = originalWarn;
|
2022-06-01 15:06:00 +08:00
|
|
|
cleanup();
|
2020-12-03 13:07:58 +08:00
|
|
|
});
|