nocobase/jest.setup.ts

21 lines
407 B
TypeScript
Raw Normal View History

2021-12-06 13:23:34 +00:00
import prettyFormat from 'pretty-format';
2022-02-15 01:11:00 +00:00
2021-12-06 13:23:34 +00:00
global['prettyFormat'] = prettyFormat;
jest.setTimeout(300000);
// 把 console.error 转换成 error方便断言
(() => {
const spy = jest.spyOn(console, 'error');
beforeAll(() => {
spy.mockImplementation((message) => {
2021-12-06 13:23:34 +00:00
console.log(message);
throw new Error(message);
});
});
afterAll(() => {
spy.mockRestore();
});
})();