forked from nextellarlabs/nextellar
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.setup.js
More file actions
30 lines (24 loc) · 817 Bytes
/
Copy pathjest.setup.js
File metadata and controls
30 lines (24 loc) · 817 Bytes
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
28
29
30
// jest.setup.js — JS equivalent of jest.setup.ts (no type annotations)
import { TextEncoder, TextDecoder } from 'util';
Object.assign(global, { TextEncoder, TextDecoder });
import { jest } from '@jest/globals';
Object.assign(global, { jest });
import '@testing-library/jest-dom';
class BroadcastChannel {
constructor(name) {
this.name = name;
this.onmessage = null;
}
postMessage(_message) {}
close() {}
}
Object.assign(global, { BroadcastChannel });
import { ReadableStream, WritableStream, TransformStream } from 'web-streams-polyfill';
Object.assign(global, { ReadableStream, WritableStream, TransformStream });
const undici = await import('undici');
Object.assign(globalThis, {
Headers: undici.Headers,
Request: undici.Request,
Response: undici.Response,
fetch: undici.fetch,
});