File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -50,12 +50,11 @@ test('times out after 1000ms by default', async () => {
50
50
) . rejects . toThrowErrorMatchingInlineSnapshot (
51
51
`"Timed out in waitForElementToBeRemoved."` ,
52
52
)
53
- // NOTE: this assertion ensures that even when we have fake timers, the
54
- // timeout still takes the full 1000ms
55
- // unfortunately, timeout clocks aren't super accurate, so we simply verify
56
- // that it's greater than or equal to 900ms. That's enough to be confident
57
- // that we're using real timers.
58
- expect ( performance . now ( ) - start ) . toBeGreaterThanOrEqual ( 900 )
53
+ // NOTE: this assertion ensures that the timeout runs in the declared (fake) clock
54
+ // while in real time the time was only a fraction since the real clock is only bound by the CPU
55
+ // So 10ms is really just an approximation on how long the CPU needs to execute our code.
56
+ // If people want to timeout in real time they should rely on their test runners.
57
+ expect ( performance . now ( ) - start ) . toBeLessThanOrEqual ( 10 )
59
58
} )
60
59
61
60
test ( 'recursive timers do not cause issues' , async ( ) => {
You can’t perform that action at this time.
0 commit comments