
Inline adoc files when they are included exactly once. Also fix language tags because this inlining gives us better information on what language the code is written in.
64 lines
1.4 KiB
Plaintext
64 lines
1.4 KiB
Plaintext
== Why is this an issue?
|
|
|
|
Starting from Mocha v3.0.0, calling ``++this.timeout(X)++`` with ``++X++`` greater than the https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout#Maximum_delay_value[maximum delay value] (2,147,483,647 ms) https://mochajs.org/#hook-level[will cause the timeout to be disabled]. This might not be what the developer intended. If the goal is really to disable the timeout, ``++this.timeout(0)++`` should be used instead.
|
|
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,javascript]
|
|
----
|
|
describe("testing this.timeout", function() {
|
|
it("unexpectedly disables the timeout", function(done) {
|
|
this.timeout(2147483648); // Noncompliant
|
|
});
|
|
});
|
|
----
|
|
|
|
|
|
=== Compliant solution
|
|
|
|
[source,javascript]
|
|
----
|
|
describe("testing this.timeout", function() {
|
|
it("doesn't disable the timeout", function(done) {
|
|
this.timeout(1000);
|
|
});
|
|
});
|
|
----
|
|
|
|
Or if you meant to disable the timeout
|
|
|
|
|
|
[source,javascript]
|
|
----
|
|
describe("testing this.timeout", function() {
|
|
it("disables the timeout as expected", function(done) {
|
|
this.timeout(0);
|
|
});
|
|
});
|
|
----
|
|
|
|
|
|
== Resources
|
|
|
|
* https://mochajs.org/#hook-level[Mocha documentation]
|
|
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
=== Message
|
|
|
|
Set this timeout to 0 if you want to disable it, otherwise use a value lower than 2147483648.
|
|
|
|
|
|
=== Highlighting
|
|
|
|
* Primary: The timeout value
|
|
|
|
|
|
endif::env-github,rspecator-view[]
|