MCPcopy Index your code
hub / github.com/codeceptjs/CodeceptJS / getCurrentTimeout

Function getCurrentTimeout

lib/timeout.js:20–37  ·  view source on GitHub ↗
(timeouts)

Source from the content-addressed store, hash-verified

18}
19
20function getCurrentTimeout(timeouts) {
21 let totalTimeout
22 // iterate over all timeouts starting from highest values of order
23 new Map([...timeouts.entries()].sort().reverse()).forEach((timeout, order) => {
24 if (
25 timeout !== undefined &&
26 // when orders >= 0 - timeout value overrides those set with higher order elements
27 (order >= 0 ||
28 // when `order < 0 && totalTimeout === undefined` - timeout is used when nothing is set by elements with higher order
29 totalTimeout === undefined ||
30 // when `order < 0` - timeout overrides higher values of timeout or 'no timeout' (totalTimeout === 0) set by elements with higher order
31 (timeout > 0 && (timeout < totalTimeout || totalTimeout === 0)))
32 ) {
33 totalTimeout = timeout
34 }
35 })
36 return totalTimeout
37}
38
39class TimeoutError extends Error {
40 constructor(message) {

Callers 1

timeoutMethod · 0.90

Calls 1

entriesMethod · 0.80

Tested by

no test coverage detected