summaryrefslogtreecommitdiffhomepage
path: root/packages/server/src
diff options
context:
space:
mode:
authorMatthew Miller <matthew@millerti.me>2022-11-16 13:40:59 -0800
committerMatthew Miller <matthew@millerti.me>2022-11-16 13:40:59 -0800
commit684182bfc3ebda7fd335cf4ce5bcfe928e8e6e25 (patch)
tree850199d2baf2454eb3160cbc3be1e55718dd5ae5 /packages/server/src
parente1ff1e0317727e0aee28f81da36b6bc8e8bc606c (diff)
Add test helper for webcrypto
Diffstat (limited to 'packages/server/src')
-rw-r--r--packages/server/src/setupTests.ts14
1 files changed, 14 insertions, 0 deletions
diff --git a/packages/server/src/setupTests.ts b/packages/server/src/setupTests.ts
index 103e5fa..b23ac59 100644
--- a/packages/server/src/setupTests.ts
+++ b/packages/server/src/setupTests.ts
@@ -1,4 +1,18 @@
+import { webcrypto } from 'node:crypto';
// Silence some console output
// jest.spyOn(console, 'log').mockImplementation();
// jest.spyOn(console, 'debug').mockImplementation();
// jest.spyOn(console, 'error').mockImplementation();
+
+/**
+ * We can use this to test runtimes in which the WebCrypto API is available
+ * on `globalThis.crypto`
+ *
+ * This shouldn't be needed anymore once we move support to Node 19+ See here:
+ * https://nodejs.org/docs/latest-v19.x/api/webcrypto.html#web-crypto-api
+ */
+// Object.defineProperty(globalThis, 'crypto', {
+// get(){
+// return webcrypto;
+// },
+// });