@wix/design-system
Version:
@wix/design-system
33 lines • 1.23 kB
JavaScript
import fetch from 'node-fetch';
import { configureUniDriver } from '@wix/unidriver-core';
// jest-canvas-mock uses jest.fn() internally; provide compat shim before loading
// @ts-expect-error jest compat shim for jest-canvas-mock
globalThis.jest = vi;
require('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