# The Ember Run Loop and Asynchronous Testing

DevFeed: [The Ember Run Loop and Asynchronous Testing](<https://devfeed.tech/articles/the-ember-run-loop-and-asynchronous-testing-15911.md>)

Original publisher: [Read original article](<https://developer.squareup.com/blog/the-ember-run-loop-and-asynchronous-testing>)

Author: Ariel Jackson

Published: 2017-09-12T22:10:18Z

Content type: article

Language: en

Sources: [Square Corner](<https://devfeed.tech/sources/square-corner-blog-medium.md>)

Topics: [Ember](<https://devfeed.tech/topics/ember.md>), [Test automation](<https://devfeed.tech/topics/test-automation.md>), [Software Testing](<https://devfeed.tech/topics/software-testing.md>), [Web app](<https://devfeed.tech/topics/webapp.md>)

Tags: [asynchronous](<https://devfeed.tech/tags/asynchronous.md>), [ember](<https://devfeed.tech/tags/ember.md>), [engineering](<https://devfeed.tech/tags/engineering.md>), [testing](<https://devfeed.tech/tags/testing.md>)

## AI overview

Recursive Ember.run.later polling can make Ember acceptance tests hang because the wait() helper waits for run loops and queued timers to finish, and recursive scheduling means work is always pending. Replacing it with setTimeout avoids that wait condition, but timers run outside Ember's queue; testing also disables autoruns, so asynchronous side effects outside an Ember.run can trigger errors. The author's solution, inspired by Ember Lifeline's pollTask, saves the next polling task during tests and advances it manually, while retaining recursive Ember.run.later in development and production. This avoids hanging tests and background timers, though the author notes it may not suit every project. The article also explains that the Run Loop organizes event work in priority queues, including synchronization before rendering.

## Source excerpt

You can't run away from the Run Loop