Skip to content
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

Conversation

omer-priel
Copy link
Contributor

@omer-priel omer-priel commented Nov 21, 2023

📑 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

Copy link

netlify bot commented Nov 21, 2023

Deploy Preview for mermaid-js ready!

Name Link
🔨 Latest commit 9ae00eb
🔍 Latest deploy log https://app.netlify.com/sites/mermaid-js/deploys/655f4bc10a4b120008f880e8
😎 Deploy Preview https://deploy-preview-5055--mermaid-js.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@github-actions github-actions bot added the Type: Bug / Error Something isn't working or is incorrect label Nov 21, 2023
Copy link

codecov bot commented Nov 21, 2023

Codecov Report

Merging #5055 (9ae00eb) into develop (4a4e614) will increase coverage by 36.70%.
The diff coverage is n/a.

Additional details and impacted files

Impacted file tree graph

@@             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     
Flag Coverage Δ
e2e 85.59% <ø> (?)
unit 42.91% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

see 160 files with indirect coverage changes

@nirname nirname requested a review from a team November 21, 2023 14:30
Copy link
Member

@aloisklink aloisklink left a 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:

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.

@omer-priel
Copy link
Contributor Author

Thanks, I will update this

@omer-priel omer-priel force-pushed the bug/5053_tests-failed-because-test-timeout branch from f54f072 to fd208dd Compare November 23, 2023 12:53
@omer-priel
Copy link
Contributor Author

omer-priel commented Nov 23, 2023

Sometimes it passed the test without change the timeout and sometimes it fails
I dont know why?
If the timeout is 20 seconds (or 10 seconds) it always passed the test

@nirname
Copy link
Contributor

nirname commented Nov 23, 2023

@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

@omer-priel
Copy link
Contributor Author

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.
And i prefer used this time for other bugs

@nirname
Copy link
Contributor

nirname commented Nov 23, 2023

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.

@omer-priel
Copy link
Contributor Author

If in the future it will return i will fix it :)

Copy link
Member

@aloisklink aloisklink left a 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 🤷

@aloisklink aloisklink added this pull request to the merge queue Nov 23, 2023
Merged via the queue into mermaid-js:develop with commit f604017 Nov 23, 2023
18 checks passed
Copy link

mermaid-bot bot commented Nov 23, 2023

@omer-priel, Thank you for the contribution!
You are now eligible for a year of Premium account on MermaidChart.
Sign up with your GitHub account to activate.

@aloisklink aloisklink added Type: Other Not an enhancement or a bug and removed Type: Bug / Error Something isn't working or is incorrect labels Nov 23, 2023
@aloisklink aloisklink changed the title update testTimeout from 5 seconds to 10 seconds tests: update testTimeout from 5 seconds to 10 seconds Nov 23, 2023
@aloisklink aloisklink changed the title tests: update testTimeout from 5 seconds to 10 seconds tests: update #registerExternalDiagrams testTimeout from 5 seconds to 20 seconds Nov 23, 2023
@omer-priel omer-priel deleted the bug/5053_tests-failed-because-test-timeout branch December 20, 2023 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Other Not an enhancement or a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 Tests failed because the test timeout is 5 seconds
3 participants