sentry-javascript icon indicating copy to clipboard operation
sentry-javascript copied to clipboard

test(core): Improve offline transport test performance

Open Lms24 opened this issue 1 year ago • 1 comments

extracted from #13439

based on #13458

This PR significantly improves the performance of our offline transport unit tests. These tests were the bottleneck of our unit test performance previously, as they included actual multi-second timeouts. This PR converts the test to use vitest's fake timers which as far as I can tell, still tests the offline transport correctly but heavily increases performance.

Locally, I this brought down the runtime of the entire test suite from ~20s to ~6s.

Lms24 avatar Aug 26 '24 11:08 Lms24

@timfish would you mind giving this PR a quick review - I think you wrote the tests initially, right?

Lms24 avatar Aug 26 '24 12:08 Lms24

Argh I tried converting this to jest after giving up on switching to vitest (#13458). Turns out jest fake timers work differently and I couldn't get the tests passing after making the switch. I don't have the time to revisit so I'm gonna close this for now.

Lms24 avatar Aug 30 '24 08:08 Lms24