diff --git a/test/security.test.ts b/test/security.test.ts index 6d74e8fe..6114e004 100644 --- a/test/security.test.ts +++ b/test/security.test.ts @@ -1,7 +1,10 @@ // @ts-ignore These tests cannot run without webcrypto if (+process.version.replace(/^v/, "").split(".").shift() < 16) return; -global.crypto = require('node:crypto').webcrypto; +// provide global crypto for older Node versions +if (!global.crypto) { + global.crypto = require('node:crypto').webcrypto; +} import { expect } from "@hapi/code"; import { fhirclient } from "../src/types";