You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For weeks, my application has been plagued by flakey failures due to different forms of the following error:
Error: [birpc] timeout on calling "onAfterSuiteRun"
Where "onAfterSuiteRun" was sometimes "snapshotSaved" or "onTaskUpdate" instead. When this happened, all of my tests would pass, but after completing the tests there would be a long pause followed by the test suite eventually failing due to the above error from somewhere within Vitest itself.
Sometimes, depending on which task timed out, the reporter UI in the terminal would end up in some kind of odd state (like a test never being marked as having completed and passed, despite having done so).
I found #1154, which is the only issue I could find related at all to birpc, but that didn't lead to any insights on how to resolve my problem.
I eventually thought to look in Discord and found this message from May, which described the same issue that I ran into along with something useful -- the error seems related to stubbing Math.random!
Sure enough, I adjusted my code to avoid the Math.random stub and I haven't seen a single one of these errors since!
Reproduction
I have a StackBlitz here that can sometimes show the issue.
Unfortunately, because it's flakey test behavior, I have been unable to consistently reproduce the error (both locally in my app's test suite, before I replaced the Math.random mock, or in StackBlitz). However, after enough times re-running the tests in StackBlitz, I eventually saw the issue a few times
Describe the bug
For weeks, my application has been plagued by flakey failures due to different forms of the following error:
Where
"onAfterSuiteRun"
was sometimes"snapshotSaved"
or"onTaskUpdate"
instead. When this happened, all of my tests would pass, but after completing the tests there would be a long pause followed by the test suite eventually failing due to the above error from somewhere within Vitest itself.Sometimes, depending on which task timed out, the reporter UI in the terminal would end up in some kind of odd state (like a test never being marked as having completed and passed, despite having done so).
I found #1154, which is the only issue I could find related at all to
birpc
, but that didn't lead to any insights on how to resolve my problem.I eventually thought to look in Discord and found this message from May, which described the same issue that I ran into along with something useful -- the error seems related to stubbing
Math.random
!Sure enough, I adjusted my code to avoid the
Math.random
stub and I haven't seen a single one of these errors since!Reproduction
I have a StackBlitz here that can sometimes show the issue.
Unfortunately, because it's flakey test behavior, I have been unable to consistently reproduce the error (both locally in my app's test suite, before I replaced the
Math.random
mock, or in StackBlitz). However, after enough times re-running the tests in StackBlitz, I eventually saw the issue a few timesSystem Info
N/A -- see reproduction in StackBlitz
Used Package Manager
npm
Validations
The text was updated successfully, but these errors were encountered: