代码拉取完成,页面将自动刷新
require('raf/polyfill');
/**
* As jsDom do not support mutationobserver and
* quill requires mutationobserver, thus a shim is needed
*/
require('mutationobserver-shim');
/**
* Mock PopperJS
*
* When using mount(), material-ui calls Popper.js, which is not compatible with JSDom
* And causes UnhandledPromiseRejectionWarning: TypeError: document.createRange is not a function
*
* @see https://github.com/FezVrasta/popper.js/issues/478
*/
jest.mock('popper.js', () => {
class Popper {
constructor() {
return {
destroy: () => {},
scheduleUpdate: () => {},
update: () => {},
};
}
}
Popper.placements = [
'auto',
'auto-end',
'auto-start',
'bottom',
'bottom-end',
'bottom-start',
'left',
'left-end',
'left-start',
'right',
'right-end',
'right-start',
'top',
'top-end',
'top-start',
];
return Popper;
});
// Ignore warnings about act()
// See https://github.com/testing-library/react-testing-library/issues/281,
// https://github.com/facebook/react/issues/14769
const originalError = console.error;
jest.spyOn(console, 'error').mockImplementation((...args) => {
if (/Warning.*not wrapped in act/.test(args[0])) {
return;
}
originalError.call(console, ...args);
});
/**
* Mock fetch objects Response, Request and Headers
*/
const { Response, Headers, Request } = require('whatwg-fetch');
global.Response = Response;
global.Headers = Headers;
global.Request = Request;
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。