InvestmentsControl/frontend/configs/jest/jest-fixed-jsdom.ts

31 lines
980 B
TypeScript

// eslint-disable-next-line import/no-import-module-exports
import JSDOMEnvironment from 'jest-environment-jsdom';
class FixedJSDOMEnvironment extends JSDOMEnvironment {
constructor(...args: unknown[]) {
// @ts-ignore
super(...args);
this.global.TextDecoder = TextDecoder;
this.global.TextEncoder = TextEncoder;
this.global.TextDecoderStream = TextDecoderStream;
this.global.TextEncoderStream = TextEncoderStream;
this.global.ReadableStream = ReadableStream;
this.global.Blob = Blob;
this.global.Headers = Headers;
// this.global.FormData = FormData;
this.global.Request = Request;
this.global.Response = Response;
this.global.fetch = fetch;
this.global.structuredClone = structuredClone;
this.global.URL = URL;
this.global.URLSearchParams = URLSearchParams;
this.global.BroadcastChannel = BroadcastChannel;
this.global.TransformStream = TransformStream;
}
}
module.exports = FixedJSDOMEnvironment;