Skip to content

Commit 6c128a5

Browse files
author
Loïc Mangeonjean
committed
fix: fix missing mock
1 parent 5b3c9aa commit 6c128a5

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

browserMock.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import fs from 'fs/promises'
22
import { performance } from 'perf_hooks'
33
import { fetch as fetchPolyfill } from 'whatwg-fetch'
4+
import crypto from 'node:crypto'
5+
6+
Object.defineProperty(globalThis, 'crypto', { value: crypto })
47

58
Object.defineProperty(document, 'queryCommandSupported', {
69
value: jest.fn().mockImplementation(() => true)
@@ -140,9 +143,7 @@ Object.defineProperty(window, 'TextDecoder', {
140143
}
141144
})
142145

143-
Object.defineProperty(window, 'Buffer', {
144-
value: undefined
145-
})
146+
Object.defineProperty(window, 'Buffer', { value: undefined })
146147

147148
// Force override performance, for some reason the implementation is empty otherwise
148149
let _performance = performance
@@ -157,8 +158,6 @@ Object.defineProperty(global, 'performance', {
157158
}
158159
})
159160

160-
global.CSS = {
161-
escape: (v) => v
162-
}
161+
global.CSS = { escape: (v) => v }
163162

164163
Element.prototype.scrollIntoView = jest.fn()

0 commit comments

Comments
 (0)