All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Add setup_globals.js to polyfill web APIs (ReadableStream, Blob, File, etc.) that undici requires but jsdom does not provide. Remove deprecated enzyme-to-json snapshot serializer which has incompatible cheerio deps. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
32 lines
817 B
JavaScript
32 lines
817 B
JavaScript
/* eslint-disable no-undef, import/order */
|
|
// Polyfill web APIs for jsdom test environment (required by undici)
|
|
const {Blob} = require('buffer');
|
|
const {ReadableStream, WritableStream, TransformStream} = require('stream/web');
|
|
|
|
class File extends Blob {
|
|
constructor(chunks, name, options = {}) {
|
|
super(chunks, options);
|
|
this.name = name;
|
|
this.lastModified = options.lastModified || Date.now();
|
|
}
|
|
}
|
|
|
|
class MessagePort {}
|
|
|
|
if (typeof global.DOMException === 'undefined') {
|
|
global.DOMException = class DOMException extends Error {
|
|
constructor(message, name) {
|
|
super(message);
|
|
this.name = name || 'Error';
|
|
}
|
|
};
|
|
}
|
|
|
|
Object.assign(global, {
|
|
ReadableStream,
|
|
WritableStream,
|
|
TransformStream,
|
|
Blob,
|
|
File,
|
|
MessagePort,
|
|
});
|