mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-24 11:10:01 +08:00
6d3973fb95
* chore(deps-dev): bump eslint-plugin-jest from 24.7.0 to 25.0.1 Bumps [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) from 24.7.0 to 25.0.1. - [Release notes](https://github.com/jest-community/eslint-plugin-jest/releases) - [Changelog](https://github.com/jest-community/eslint-plugin-jest/blob/main/CHANGELOG.md) - [Commits](https://github.com/jest-community/eslint-plugin-jest/compare/v24.7.0...v25.0.1) --- updated-dependencies: - dependency-name: eslint-plugin-jest dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * chore: fix eslint errors and warnings * fix rc-slider version Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
29 lines
651 B
TypeScript
29 lines
651 B
TypeScript
// eslint-disable-next-line no-console
|
|
const originError = console.error;
|
|
|
|
/** This function will remove `useLayoutEffect` server side warning. Since it's useless. */
|
|
export function excludeWarning() {
|
|
const errorSpy = jest.spyOn(console, 'error').mockImplementation((msg, ...rest) => {
|
|
if (String(msg).includes('useLayoutEffect does nothing on the server')) {
|
|
return;
|
|
}
|
|
originError(msg, ...rest);
|
|
});
|
|
|
|
return () => {
|
|
errorSpy.mockRestore();
|
|
};
|
|
}
|
|
|
|
export default function excludeAllWarning() {
|
|
let cleanUp: Function;
|
|
|
|
beforeAll(() => {
|
|
cleanUp = excludeWarning();
|
|
});
|
|
|
|
afterAll(() => {
|
|
cleanUp();
|
|
});
|
|
}
|