Basic setup of the project.
This commit is contained in:
17
scripts/jest.setup.js
Normal file
17
scripts/jest.setup.js
Normal file
@@ -0,0 +1,17 @@
|
||||
// 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());
|
||||
};
|
Reference in New Issue
Block a user