🚀 Feature: New repeat
option to run tests an arbitrary number of times
#4936
Labels
repeat
option to run tests an arbitrary number of times
#4936
Is your feature request related to a problem or a nice-to-have?? Please describe.
This is definitely a nice-to-have. Oftentimes, I'm debugging flakey tests or tests with race conditions and I want to see if I've fixed the flakiness. I usually approach this by running the test many times as an easy confirmation that the test is fixed. I usually just use a bash loop to run the test command numerous times but this has a few drawbacks
Describe the solution you'd like
A
repeat
option would solve this issue. The option would be numeric and default to one. When mocha executes a test, I envision mocha just looping and running the test however many times are specified.Describe alternatives you've considered
I've tried the
bash
loop I mentioned in the description (I outlined some challenges there as well).The other approach I've used is to wrap each test in a loop, but this breaks down if I'm using a
--grep
or I'm working with many tests. It's also just slightly cumbersome to wrap each test in a loop, and each loop needs the same hard-coded limit. doable, but annoying.Additional context
Happy to work with the maintainers and contribute this feature if there is interest!
The text was updated successfully, but these errors were encountered: