-
Notifications
You must be signed in to change notification settings - Fork 781
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Core: Deprecate unset timeout for tests taking longer than 3 seconds
Up until now, QUnit has not defined or enforced any default timeout. This means if your test timed out or got stuck, this would be silent and could (depending on how you run/integrate your tests) be hard to find the cause of, and might take a long time to even detect as it would be subject to a higher-level timeout (e.g. some kind of maximum process time or CI limit). In QUnit 3.0, the default timeout will change from undefined (effectively Infinity) to 3 seconds. This only effects you if you * do not have `QUnit.config.testTimeout` set, * and, have one or more tests exceeding 3 seconds, * and, are not calling `assert.timeout()` inside this test. Starting in QUnit 2.21, a deprecation warning will be logged, at most once per test run, if you have no timeout defined, and a test takes longer than 3 seconds. You can prepare yourself for QUnit 3 when this happens by calling `assert.timeout()` inside those tests, or by setting `QUnit.config.testTimeout` globally with a higher timeout as-needed.
- Loading branch information
Showing
9 changed files
with
91 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
QUnit.test('fast async', function (assert) { | ||
var done = assert.async(); | ||
assert.true(true); | ||
setTimeout(done, 7); | ||
}); | ||
|
||
QUnit.test('slow async 1', function (assert) { | ||
var done = assert.async(); | ||
assert.true(true); | ||
setTimeout(done, 3500); | ||
}); | ||
|
||
QUnit.test('slow async 2', function (assert) { | ||
var done = assert.async(); | ||
assert.true(true); | ||
setTimeout(done, 3500); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# command: ["qunit", "config-testTimeout-deprecated.js"] | ||
|
||
TAP version 13 | ||
ok 1 fast async | ||
ok 2 slow async 1 | ||
ok 3 slow async 2 | ||
1..3 | ||
# pass 3 | ||
# skip 0 | ||
# todo 0 | ||
# fail 0 | ||
|
||
# stderr | ||
Test "slow async 1" took longer than 3000ms, but no timeout was set. Set QUnit.config.testTimeout or call assert.timeout() to avoid a timeout in QUnit 3. https://qunitjs.com/api/config/testTimeout/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters