Skip to content

Commit c19db75

Browse files
committed
fix: add crypto module for Node.js compatibility in jest config
- Added the crypto module to the jest configuration to resolve the ReferenceError: crypto is not defined. - Ensured compatibility with Node.js versions prior to 19 by explicitly setting the global.crypto to webcrypto.
1 parent 5b89fac commit c19db75

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

packages/integration-test/jest.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
// The error ReferenceError: crypto is not defined occurs because the Node.js environment needs the crypto module to be explicitly available.
2+
// For Node.js versions before 19, you need to add the crypto global explicitly.
3+
const { webcrypto } = require('crypto');
4+
global.crypto = webcrypto;
5+
16
const jestCommonConfig = require('../../jest.config');
27

38
/** @type {import('jest').Config} */

0 commit comments

Comments
 (0)