We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8943db7 commit e412dd2Copy full SHA for e412dd2
2 files changed
jest.config.js
@@ -1,4 +1,4 @@
1
-module.exports = {
+export default {
2
// verbose: true, // Uncomment for detailed test output
3
collectCoverage: true,
4
coverageDirectory: 'coverage',
test/helpers/setup.ts
@@ -4,11 +4,11 @@ import 'isomorphic-fetch'
import { TextEncoder, TextDecoder } from 'util'
5
6
// https://stackoverflow.com/questions/52612122/how-to-use-jest-to-test-functions-using-crypto-or-window-mscrypto
7
-// globalThis.crypto = require('crypto').webcrypto // with node >=16
8
-const nodeCrypto = require('crypto')
+
+import crypto from 'crypto'
9
global.crypto = {
10
getRandomValues: function (buffer) {
11
- return nodeCrypto.randomFillSync(buffer)
+ return crypto.randomFillSync(buffer)
12
}
13
14
0 commit comments