-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetupFiles.js
27 lines (23 loc) · 919 Bytes
/
setupFiles.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// optional: configure or set up a testing framework before each test
// if you delete this file, remove `setupFilesAfterEnv` from `jest.config.js`
/* eslint-disable @typescript-eslint/no-var-requires */
import dotenv from 'dotenv';
dotenv.config();
const { TextDecoder, TextEncoder } = require('node:util');
const { ReadableStream } = require('node:stream/web');
Object.defineProperties(globalThis, {
TextDecoder: { value: TextDecoder },
TextEncoder: { value: TextEncoder },
ReadableStream: { value: ReadableStream },
});
const { Blob, File } = require('node:buffer');
const { fetch, Headers, FormData, Request, Response } = require('undici');
Object.defineProperties(globalThis, {
fetch: { value: fetch, writable: true },
Blob: { value: Blob },
File: { value: File },
Headers: { value: Headers },
FormData: { value: FormData },
Request: { value: Request },
Response: { value: Response },
});