Initial Commit
This commit is contained in:
9
packages/foundation/data/packer/tests/setup/polyfills.ts
Normal file
9
packages/foundation/data/packer/tests/setup/polyfills.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
// Vitest setup polyfills for @suaveplan/packer.
|
||||
// Ensure `globalThis.crypto` is available in bare-Node vitest runs (Node 18.x).
|
||||
import { webcrypto } from "node:crypto";
|
||||
|
||||
type WritableGlobal = { crypto?: Crypto };
|
||||
const g = globalThis as WritableGlobal;
|
||||
if (g.crypto === undefined) {
|
||||
g.crypto = webcrypto as unknown as Crypto;
|
||||
}
|
||||
Reference in New Issue
Block a user