Page MenuHomePhabricator

Use emulated setTimeout in unit testing
Closed, ResolvedPublic1 Estimated Story Points

Description

For testing code logic that uses setTimeout, use of an emulated setTimeout implementation can:

  • allow a precise execution order scenario to be specified
  • avoid actual n-millisecond pauses and race conditions
  • enable fully synchronous execution, giving better stack traces, and avoiding problems if an exception is raised before QUnit.start() / assert.async()...done() runs.

Not much code needs this, but it better testing could avoid some really nasty debugging headaches later on.

Event Timeline

Change 277594 had a related patch set uploaded (by Divec):
Emulated setTimeout for unit testing

https://gerrit.wikimedia.org/r/277594

Change 277594 merged by Jforrester:
Emulated setTimeout for unit testing

https://gerrit.wikimedia.org/r/277594

Jdforrester-WMF edited projects, added Technical-Debt; removed Patch-For-Review.
Jdforrester-WMF set the point value for this task to 1.