mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-16 01:40:53 +08:00
6d26ee61d1
* publish beta * chore: amis 暴露版本信息供外部读取 * 解决用例报错
34 lines
865 B
JavaScript
34 lines
865 B
JavaScript
const originalWarn = console.warn.bind(console.warn);
|
|
require('@testing-library/jest-dom');
|
|
require('moment-timezone');
|
|
const moment = require('moment');
|
|
moment.tz.setDefault('Asia/Shanghai');
|
|
const cleanup = require('@testing-library/react').cleanup;
|
|
|
|
// https://github.com/nrwl/nx/issues/1178
|
|
// 解决jest 运行的时候报:
|
|
// ReferenceError: DragEvent is not defined
|
|
Object.defineProperty(window, 'DragEvent', {
|
|
value: class DragEvent {}
|
|
});
|
|
|
|
global.__buildVersion = '';
|
|
|
|
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;
|
|
cleanup();
|
|
});
|