import { webcrypto } from "node:crypto"; type WritableGlobal = { crypto?: Crypto; File?: unknown }; const g = globalThis as WritableGlobal; if (g.crypto === undefined) { g.crypto = webcrypto as unknown as Crypto; } // testcontainers/undici requires File global in Node environments if (g.File === undefined) { g.File = class File extends Blob { readonly name: string; readonly lastModified: number; constructor( fileBits: BlobPart[], fileName: string, options?: FilePropertyBag ) { super(fileBits, options); this.name = fileName; this.lastModified = options?.lastModified ?? Date.now(); } }; }