Skip to content

🚀 Feature: Allow to set timeout on before/after/beforeEach/afterEach in declaration #5202

@perrin4869

Description

@perrin4869

Feature Request Checklist

Overview

it returns a TestFunction that has a timeout method. This is useful for setting timeouts in slow tests, without needing to define the test code inside a function() {} block.
An analogous feature would be useful for the before/beforeEach/after/afterEach hooks. The current workaround would be:

before(function() {
  this.timeout(3000);
});

Suggested Solution

before/beforeEach/after/afterEach could return a HookFunction, analogous to TestFunction, which has a timeout method. The code above could be rewritten:

before(() => {}).timeout(3000);

Alternatives

None

Additional Info

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions