Files
TSinjex/scripts/jest.setup.js
2024-08-14 19:40:05 +02:00

18 lines
422 B
JavaScript

// jest.setup.js
const getCircularReplacer = () => {
const seen = new WeakSet();
return (key, value) => {
if (typeof value === 'object' && value !== null) {
if (seen.has(value)) {
return;
}
seen.add(value);
}
return value;
};
};
global.customJSONStringify = (object) => {
return JSON.stringify(object, getCircularReplacer());
};