Skip to content

🚀 Feature: Make "slow" (by default) a function of "timeout" #3600

@boneskull

Description

@boneskull

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    semver-majorimplementation requires increase of "major" version number; "breaking changes"status: wontfixtypically a feature which won't be added, or a "bug" which is actually intended behaviortype: discussiondebates, philosophy, navel-gazing, etc.type: featureenhancement proposal

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions