Skip to content

Commit

Permalink
Polyfill window.crypto.getRandomValues in tests (#2808)
Browse files Browse the repository at this point in the history
  • Loading branch information
garrettjstevens authored Mar 15, 2022
1 parent b183df6 commit 55f312c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions config/jest/crypto.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
var nodeCrypto = require('crypto')

global.crypto = {
getRandomValues: buffer => nodeCrypto.randomFillSync(buffer),
}
1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ module.exports = {
'<rootDir>/config/jest/createRange.js',
'<rootDir>/config/jest/fetchMock.js',
'<rootDir>/config/jest/console.js',
'<rootDir>/config/jest/crypto.js',
'jest-localstorage-mock',
],
testURL: 'http://localhost',
Expand Down

0 comments on commit 55f312c

Please sign in to comment.