Skip to content

Commit e412dd2

Browse files
committed
jest ESM config
1 parent 8943db7 commit e412dd2

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

jest.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = {
1+
export default {
22
// verbose: true, // Uncomment for detailed test output
33
collectCoverage: true,
44
coverageDirectory: 'coverage',

test/helpers/setup.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ import 'isomorphic-fetch'
44
import { TextEncoder, TextDecoder } from 'util'
55

66
// 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')
7+
8+
import crypto from 'crypto'
99
global.crypto = {
1010
getRandomValues: function (buffer) {
11-
return nodeCrypto.randomFillSync(buffer)
11+
return crypto.randomFillSync(buffer)
1212
}
1313
}
1414

0 commit comments

Comments
 (0)