Skip to content

Commit

Permalink
Use native crypto in node versions that have it
Browse files Browse the repository at this point in the history
  • Loading branch information
vlad-ignatov committed Aug 23, 2024
1 parent 0d7ae0b commit d8c4738
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion test/security.test.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down

0 comments on commit d8c4738

Please sign in to comment.