setTimeout
Sets a timeout for all tests in this scope, and nested scopes.
setTimeout(timeoutMs: number): void
Notes
- This method must be called within the function that’s passed to describe().
- When a timeout has been set, tests within this scope fail automatically when the timeout has been reached; however, test functions may keep running unless currently awaiting any of the asynchronous methods of TestCase.
Parameters
- timeoutMs — Amount of time after which a test will be timed out, in milliseconds
Example
describe("My scope", (scope) => {
scope.setTimeout(1000);
test("This times out automatically", async () => {
// ... do something that may time out
})
});
Related
- class TestScopeA class that represents a test scope, containing a number of test cases.