I get sick of adjusting slow when adjusting timeout to avoid the warnings.
Unless slow is set by the user, what if we made it a function of the timeout value?
The current default values are 75ms for slow and 200ms for timeout. The function could be, then:
slow = timeout => 0.375 * timeout
(If there's a different function that makes more sense, that'd be cool too)
I propose:
- If a user provides
--slow, that's the value we use.
- If a user provides
--timeout but no --slow, we use the above function to determine the value of slow
- The equation is computed per-
Runnable. Meaning if we see a this.timeout(2000) (but importantly, no this.slow(x)) in a Runnable, then we adjust the slow value using the function.
- If the user provides
this.slow(x) in a Runnable, we use that value, otherwise we revert to whatever's used in the parent context. If it's set explicitly via this.slow(x) in some parent context, use that; if it's set via --slow do the same. If it's not set anywhere, use the function.
An alternative:
- If
slow is less than 1, it's no longer in milliseconds; it's considered a percentage of the value of timeout. We could get away with shipping that in a minor
Thoughts? @mochajs/core
I get sick of adjusting
slowwhen adjustingtimeoutto avoid the warnings.Unless
slowis set by the user, what if we made it a function of thetimeoutvalue?The current default values are 75ms for
slowand 200ms fortimeout. The function could be, then:(If there's a different function that makes more sense, that'd be cool too)
I propose:
--slow, that's the value we use.--timeoutbut no--slow, we use the above function to determine the value ofslowRunnable. Meaning if we see athis.timeout(2000)(but importantly, nothis.slow(x)) in aRunnable, then we adjust theslowvalue using the function.this.slow(x)in aRunnable, we use that value, otherwise we revert to whatever's used in the parent context. If it's set explicitly viathis.slow(x)in some parent context, use that; if it's set via--slowdo the same. If it's not set anywhere, use the function.An alternative:
slowis less than 1, it's no longer in milliseconds; it's considered a percentage of the value oftimeout. We could get away with shipping that in a minorThoughts? @mochajs/core