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

docs: docs for options lack clarity #7296

Open
6 tasks done
benmccann opened this issue Jan 19, 2025 · 5 comments
Open
6 tasks done

docs: docs for options lack clarity #7296

benmccann opened this issue Jan 19, 2025 · 5 comments
Labels
documentation Improvements or additions to documentation p2-to-be-discussed Enhancement under consideration (priority)

Comments

@benmccann
Copy link
Contributor

Describe the bug

https://vitest.dev/api/#test does not show if any options can be used with the test function

The only place options are shown as being used is https://vitest.dev/api/#describe-only which says the options may be a number, but it gives no description of what the number represents. It also says the options are the third argument and I wonder if this is correct since the migration guide suggests that you need to migrate from it being the third argument to it being the second argument (https://vitest.dev/guide/migration#test-options-as-a-third-argument) for the test function and it would be surprising if test and describe.only took arguments in different orders

Reproduction

https://vitest.dev/api/

System Info

vite 3

Used Package Manager

pnpm

Validations

@benmccann
Copy link
Contributor Author

Something that might be worth mentioning in the migration guide for Vitest 3 is that Vitest 2 seems to have an infinite default timeout whereas Vitest 3 has a 5 second default timeout. I had to set the timeout option a bunch of places to get longer running tests passing with Vitest 3

@sheremet-va
Copy link
Member

sheremet-va commented Jan 19, 2025

The only place options are shown as being used is https://vitest.dev/api/#describe-only

To be fair, the first section of the page has this with examples:

Most options support both dot-syntax and object-syntax allowing you to use whatever style you prefer.

The assumption is that users understand the difference between test.skip and test(name, { skip }) by looking at examples and can apply this knowledge for every sensible ("most") option on the page

I guess, we can also mention double syntax everywhere? Seems a bit of an overkill

@sheremet-va
Copy link
Member

Something that might be worth mentioning in the migration guide for Vitest 3 is that Vitest 2 seems to have an infinite default timeout whereas Vitest 3 has a 5 second default timeout. I had to set the timeout option a bunch of places to get longer running tests passing with Vitest 3

Vitest always had a 5 seconds timeout

@benmccann
Copy link
Contributor Author

Ah, I didn't see that there was more than one example until reading your reply here as I didn't notice that you had to tab to the second example. I don't think you need to repeat it everywhere, but I couldn't find it at all. It might help to show the first example and then say "or you can also do..." and then show the second example so that the second one is showing by default. Or show the options example first because there's already plenty of docs for things like test.skip already that are easier to find

Not sure about the timeout issue, but we had lots of tests going way past the 5 second timeout. Whatever the issue was it seems to be working with vitest 3, so not sure it's worth much time debugging it, but we did have to reconfigure the timeouts now that they're getting applied: sveltejs/kit#13330

@sheremet-va
Copy link
Member

Not sure about the timeout issue, but we had lots of tests going way past the 5 second timeout. Whatever the issue was it seems to be working with vitest 3

Ah, I see. Synchronous functions were bugged and never timeout out, you are right, this was one of the fixes in Vitest 3

@sheremet-va sheremet-va added documentation Improvements or additions to documentation p2-to-be-discussed Enhancement under consideration (priority) and removed pending triage labels Jan 22, 2025
@sheremet-va sheremet-va moved this to P2 - 2 in Team Board Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation p2-to-be-discussed Enhancement under consideration (priority)
Projects
Status: P2 - 2
Development

No branches or pull requests

2 participants