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

Running tests in random order #11847

Open
mjhamm75 opened this issue Jun 13, 2024 · 0 comments
Open

Running tests in random order #11847

mjhamm75 opened this issue Jun 13, 2024 · 0 comments
Labels
bun:test Something related to the `bun test` runner enhancement New feature or request

Comments

@mjhamm75
Copy link

mjhamm75 commented Jun 13, 2024

What is the problem this feature would solve?

Some times tests do things they shouldn't do, like modify global state or writes something to a db that doesn't get cleaned up. When we run tests in the same order, these issues can leave sneaky defects.

Many other runners have this functionality. Here are 2 examples.
https://jestjs.io/docs/cli#--randomize
https://rubydoc.info/gems/rspec-core/RSpec%2FCore%2FConfiguration:seed

In fact, RSpec now runs the tests randomly by default.

What is the feature you are proposing to solve the problem?

I propose a flag and a seed would be passed to the runner to randomize the order of the tests. The tests would then run in a random order (determined by the seed).

The seed would allow us to replicate a run in case there was an issue and we wanted to run in the same order again.

What alternatives have you considered?

I was using Jest in the past and would use this flag extensively. I want to stay with Bun, bc the performance is so good. I cannot find any good work arounds in the Bun ecosystem.

@mjhamm75 mjhamm75 added the enhancement New feature or request label Jun 13, 2024
@nektro nektro added the bun:test Something related to the `bun test` runner label Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bun:test Something related to the `bun test` runner enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants