-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tests: update #registerExternalDiagrams
testTimeout from 5 seconds to 20 seconds
#5055
tests: update #registerExternalDiagrams
testTimeout from 5 seconds to 20 seconds
#5055
Conversation
✅ Deploy Preview for mermaid-js ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## develop #5055 +/- ##
============================================
+ Coverage 42.91% 79.61% +36.70%
============================================
Files 23 164 +141
Lines 5029 13869 +8840
Branches 21 698 +677
============================================
+ Hits 2158 11042 +8884
+ Misses 2870 2677 -193
- Partials 1 150 +149
Flags with carried forward coverage won't be shown. Click here to find out more. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work @omer-priel, I've randomly encountered the same issue on my tests, but I didn't expect it to be fixed by just increasing the timeout.
I don't think we should be updating the test timeout for all tests.
Instead, can you update the test timeout for each test individually?
E.g. adding the new timeout in:
}); mermaid/packages/mermaid/src/mermaid.spec.ts
Line 151 in 4a4e614
}); }); });
All of the it()
functions in vitest support adding a timeout as their last param, see https://vitest.dev/api/#test, so we should just need to change them to }, 10_000);
(or 20_000
).
Maybe we should also bump the timeout to 20s? If it's taking more than 5seconds for you and me, I'm sure it'll be even slower on older PCs.
Thanks, I will update this |
f54f072
to
fd208dd
Compare
Sometimes it passed the test without change the timeout and sometimes it fails |
@omer-priel I think you are the first one who are really digging into the problem. It would be great if you could provide a comprehensive answer to your own question and share it with the community. May be it is due to some async code that is used as a synchronous one. But that is just a blind guess. Increasing timeout without understanding the nature of the issue is a temporary patch. So I can agree even on 1 minute wait if it would guarantee that never again we would have to increase that value |
I can learn more and try to find the root of this problem. But, if the timeout be less then 1 minute. Then this problem not worth the time. |
Yep, you are absolutely right. 20 seconds is more or less OK as a temporary solution. If there is a high chance of failures regardless of the timeout then it's not worth it. But if slight increase helps significantly then we are good to go. I think everybody can put up with a few more seconds of waiting instead of addressing the same question "why my tests fail" over and over in Slack. |
If in the future it will return i will fix it :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me :)
Normally I'll keep this PR open for other people to review, but since this PR is very small, low risk, and will have a big benefit for everybody, I'll merge this now!
Sometimes it passed the test without change the timeout and sometimes it fails
I dont know why?
I suspect the issue might be to do with Vite.
Maybe these tests are waiting for Vite to build something and on slower computers (or maybe slow computers with multiple cores?), Vite is still building something during these tests and it fails.
It would maybe explain why the tests only fail the first time you run tests, since the next time might have some cached data.
We are planning on moving away from Vite to ESBuild in the next Mermaid v11 release (see #4729), and ESBuild is much faster, so maybe this issue will fix itself in the future 🤷
@omer-priel, Thank you for the contribution! |
#registerExternalDiagrams
testTimeout from 5 seconds to 20 seconds
📑 Summary
Brief description about the content of your PR.
resolves #5053
📏 Design Decisions
Describe the way your implementation works or what design decisions you made if applicable.
📋 Tasks
Make sure you
MERMAID_RELEASE_VERSION
is used for all new features.develop
branch