ssr-web-avo-inspector
Version:
Avo Inspector for web with SSR and web workers support
15 lines (13 loc) • 479 B
JavaScript
// Polyfill TextEncoder/TextDecoder for jsdom environment
const { TextEncoder, TextDecoder } = require('util');
if (!globalThis.TextEncoder) {
globalThis.TextEncoder = TextEncoder;
}
if (!globalThis.TextDecoder) {
globalThis.TextDecoder = TextDecoder;
}
// Polyfill crypto.subtle for jsdom test environment
const { webcrypto } = require('crypto');
if (!globalThis.crypto || !globalThis.crypto.subtle) {
Object.defineProperty(globalThis, 'crypto', { value: webcrypto });
}