@@ -4,22 +4,19 @@ import type {
4
4
import type { VitestClient } from '@vitest/ws-client'
5
5
6
6
const { get } = Reflect
7
- const safeRandom = Math . random
8
7
9
8
function withSafeTimers ( getTimers : typeof getSafeTimers , fn : ( ) => void ) {
10
9
const { setTimeout, clearTimeout, nextTick, setImmediate, clearImmediate } = getTimers ( )
11
10
12
11
const currentSetTimeout = globalThis . setTimeout
13
12
const currentClearTimeout = globalThis . clearTimeout
14
- const currentRandom = globalThis . Math . random
15
13
const currentNextTick = globalThis . process . nextTick
16
14
const currentSetImmediate = globalThis . setImmediate
17
15
const currentClearImmediate = globalThis . clearImmediate
18
16
19
17
try {
20
18
globalThis . setTimeout = setTimeout
21
19
globalThis . clearTimeout = clearTimeout
22
- globalThis . Math . random = safeRandom
23
20
globalThis . process . nextTick = nextTick
24
21
globalThis . setImmediate = setImmediate
25
22
globalThis . clearImmediate = clearImmediate
@@ -30,7 +27,6 @@ function withSafeTimers(getTimers: typeof getSafeTimers, fn: () => void) {
30
27
finally {
31
28
globalThis . setTimeout = currentSetTimeout
32
29
globalThis . clearTimeout = currentClearTimeout
33
- globalThis . Math . random = currentRandom
34
30
globalThis . setImmediate = currentSetImmediate
35
31
globalThis . clearImmediate = currentClearImmediate
36
32
nextTick ( ( ) => {
0 commit comments