Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Assert: Fix assert.timeout() bug causing a non-async test to fail
For an async test, we normally remember the assigned timeout amount, and the actual scheduling and enforcement of the timeout doesn't happen until after the test callback returns. If the test doesn't happen to be asynchronous, then the amount is discarded and we simply move on to the next test. Sometimes, the timeout ID stored in `config.timeout` for a previous async test would remain and thus caused `assert.timeout()` to wrongly think it was called twice in the same test, and tries clear and reschedule it, when actually it is clearing nothing and scheduling the first timeout and doing so before the test callback has returned. Thus when the test is over and we "ignore" the timeout, QUnit then got confused thinking it's an async test and thus waits until it times out. Fix this by making sure `config.timeout` is always explicitly emptied (or re-assigned) when a timeout is cancelled or has completed. Fixes #1539.
- Loading branch information