Skip to content

Commit

Permalink
Update src/test/index_node.js
Browse files Browse the repository at this point in the history
  • Loading branch information
mryhryki committed Aug 5, 2023
1 parent 30d4b57 commit b60f617
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/test/index_node.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@ import * as crypto from "crypto";
import { test } from "./index.js";
import { decrypt, encrypt } from "@mryhryki/simple-encryption";

globalThis.crypto = crypto.webcrypto;
// Node.js v19 and later, there is `crypto` in `globalThis`.
// Ref: https://github.com/nodejs/node/pull/42083
if (!('crypto' in globalThis)) {
globalThis.crypto = crypto.webcrypto;
}
test({ encrypt, decrypt });

0 comments on commit b60f617

Please sign in to comment.