Files
twenty/packages/twenty-front/setupTests.ts
T
Charles BochetandGitHub b14063fe06 Re-add prettier (#13812)
Re add prettier in eslint.configs
2025-08-11 14:10:04 +02:00

33 lines
1006 B
TypeScript

// jest-dom adds custom jest matchers for asserting on DOM nodes.
// allows you to do things like:
// expect(element).toHaveTextContent(/react/i)
// learn more: https://github.com/testing-library/jest-dom
import '@testing-library/jest-dom';
// Add Jest matchers for toThrowError and other missing methods
declare global {
namespace jest {
interface Matchers<R> {
toThrowError(error?: string | RegExp | Error): R;
toMatchSnapshot(propertyMatchers?: any): R;
}
}
namespace Vi {
interface Assertion {
toMatchSnapshot(propertyMatchers?: any): void;
}
}
}
/**
* The structuredClone global function is not available in jsdom, it needs to be mocked for now.
*
* The most naive way to mock structuredClone is to use JSON.stringify and JSON.parse. This works
* for arguments with simple types like primitives, arrays and objects, but doesn't work with functions,
* Map, Set, etc.
*/
global.structuredClone = (val) => {
return JSON.parse(JSON.stringify(val));
};