@wix/design-system
Version:
@wix/design-system
33 lines • 1.23 kB
JavaScript
import fetch from 'node-fetch';
import { configureUniDriver } from '@wix/unidriver-core';
// Import order matters: the shim aliases `jest` -> `vi` on the global, which
// jest-canvas-mock needs at module-evaluation time.
import './jest-canvas-mock-shim';
import 'jest-canvas-mock';
vi.mock('../deprecationLog');
configureUniDriver({
defaultTimeout: 2_500,
});
// @ts-expect-error node-fetch types differ from global fetch
global.fetch = fetch;
// @ts-expect-error node-fetch types differ from global fetch
global.setImmediate = global.setTimeout;
global.ResizeObserver = class {
observe() { }
unobserve() { }
disconnect() { }
};
// Suppress noisy React deprecation warnings in test output
const originConsoleError = console.error;
const suppressedWarnings = [
'findDOMNode is deprecated',
'uses the legacy childContextTypes API which is no longer supported',
'uses the legacy contextTypes API which is no longer supported',
];
console.error = (...args) => {
const isSuppressed = args.some(arg => typeof arg === 'string' && suppressedWarnings.some(w => arg.includes(w)));
if (!isSuppressed) {
originConsoleError.apply(console, args);
}
};
//# sourceMappingURL=vitest-setup.js.map