-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.setup.js
More file actions
25 lines (19 loc) · 887 Bytes
/
jest.setup.js
File metadata and controls
25 lines (19 loc) · 887 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/*---------------------------------------------------------------
Developed by @jams2blues – ZeroContract Studio
File: jest.setup.js
Rev : r3 2025-09-18
Summary: Synchronous util polyfills for TextEncoder/TextDecoder and URL.createObjectURL in jsdom.
---------------------------------------------------------------*/
import { TextEncoder as UtilTextEncoder, TextDecoder as UtilTextDecoder } from 'node:util';
if (typeof globalThis.TextEncoder === 'undefined' && typeof UtilTextEncoder === 'function') {
globalThis.TextEncoder = UtilTextEncoder;
}
if (typeof globalThis.TextDecoder === 'undefined' && typeof UtilTextDecoder === 'function') {
globalThis.TextDecoder = UtilTextDecoder;
}
if (typeof URL.createObjectURL !== 'function') {
URL.createObjectURL = () => 'blob:jest-mock';
}
if (typeof URL.revokeObjectURL !== 'function') {
URL.revokeObjectURL = () => {};
}