Skip to content

Commit 325ad4b

Browse files
committed
test(web): the shim tests do not assume a global crypto, which Node 18 lacks
1 parent 146f0f3 commit 325ad4b

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎web/test/unit/shims.test.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
const assert = require('assert');
1414
const nodePath = require('path');
1515
const nodeCrypto = require('crypto');
16+
// A browser always has the global; Node has had it since 19 (18 only behind a flag). The shim is for the browser.
17+
if (!globalThis.crypto) { globalThis.crypto = nodeCrypto.webcrypto; }
1618

1719
const SHIMS = nodePath.join(__dirname, '..', '..', 'ai-extension', 'shims');
1820
const shimPath = require(nodePath.join(SHIMS, 'path.js'));

0 commit comments

Comments
 (0)