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

Run tests NOT in random order - unshuffle #3922

Closed
4 tasks done
ziimakc opened this issue Aug 9, 2023 · 3 comments · Fixed by #6670
Closed
4 tasks done

Run tests NOT in random order - unshuffle #3922

ziimakc opened this issue Aug 9, 2023 · 3 comments · Fixed by #6670
Labels
enhancement New feature or request

Comments

@ziimakc
Copy link

ziimakc commented Aug 9, 2023

Clear and concise description of the problem

When global tests configuration shuffle is set to true to ensure tests isolation there is no way to run some specific test suite in non-random order.

This is required when you have long integration test which is split in multiple blocks, for example:

describe('long auth test with sequential order', ()=>{
   it('test 1 register', ()=>{})
   it('test 2 login', ()=>{})
   it('test 3 logout', ()=>{})
})

This is similar to #3731

Suggested solution

Add option describe.unshuffle to run specific test block in non-shuffled order

Alternative

Add logic to existing describe.sequential to run specific test block in non-shuffled order

Additional context

No response

Validations

@sheremet-va sheremet-va added the enhancement New feature or request label Aug 17, 2023
@JesusTheHun
Copy link

Same here. I want to shuffle by default, but when I use describe.sequential(...) I expect the suite to run sequentially.
In many cases, the behaviour described inside vitest.config.ts can be overwritten locally : timeout, hookTimeout, repeats, retry, they can all set in situ.

@sheremet-va
Copy link
Member

You can disable shuffle in a single file or next describe block with vi.setConfig({ sequence: { shuffle: false } })

And to undo this you can call vi.resetConfig

@mwood23
Copy link

mwood23 commented Feb 6, 2024

+1 here. I want to shuffle tests to make sure my integration tests are side effect free. However, for big ones I like having a sequential describe block to make it easier to read.

describe.sequential.unshuffle? I think you could argue that 99% of people want sequential tests in order, but it sorta overloads what that means.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
4 participants