You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
👍 Agreed, I'm surprised they didn't have this already! This took me a bit to parse through as someone who doesn't use those APIs much. Putting a summary here for clarity...
There are two ways to describe a timeout:
this.timeout(...);: allowed for hooks (before(...), etc.) as well as tests (it(...), etc.)
test.timeout(...): only allowed for tests
Assuming I'm understanding correctly, this issue is asking to allow hook.timeout(...). Doing so would mirror the test.timeout(...) already allowed.
@JoshuaKGoldberg thanks for summarizing it more clearly than the original post 🙂
ok, I just looked into the codebase, and I think this will be very simple to implement, but I am not sure about potential implications. I will send a PR shortly
Feature Request Checklist
faq
label, but none matched my issue.Overview
it
returns aTestFunction
that has atimeout
method. This is useful for setting timeouts in slow tests, without needing to define the test code inside afunction() {}
block.An analogous feature would be useful for the
before/beforeEach/after/afterEach
hooks. The current workaround would be:Suggested Solution
before/beforeEach/after/afterEach
could return aHookFunction
, analogous toTestFunction
, which has atimeout
method. The code above could be rewritten:Alternatives
None
Additional Info
No response
The text was updated successfully, but these errors were encountered: