Skip to content

Commit 1657815

Browse files
authored
test(core): Improve unit test performance for offline transport tests (#18628)
The `offline.test.ts` unit tests in core have been bugging me for a long time because they take almost 30s to run locally. Which makes running tests in watch mode in core quite annoying. The core problem in these tests was that we used real timers and waited for up to 25s in one test. This PR: - uses vitest's fake timers instead of real timers - removes the `waitUntil` calls in favor of advancing timers. Mostly by the upper bound we specified before, though in some situations, I had to use a lower value because the previous waitUntil condition was satisfied earlier. - re-enables the rate limiting test which was flaky before. I'm curious if it'll flake again but my guess is that with the more strict fake timers, it might just behave as we hope. Now, the tests only take a couple of ms to complete. Closes #18630 (added automatically)
1 parent 4942b07 commit 1657815

File tree

1 file changed

+154
-139
lines changed

1 file changed

+154
-139
lines changed

0 commit comments

Comments
 (0)