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 860fbc5 commit c0b3bda
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/test/index_node.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { webcrypto } from "node:crypto";
import * as crypto from "crypto";
import { test } from "./index.js";
import { decrypt, encrypt } from "@mryhryki/simple-encryption";

globalThis.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 c0b3bda

Please sign in to comment.