emberjs / emberjs/ember-test-helpers
`teardownContext` causing tests to hang
- Dominant language
- JavaScript
- Stars
- 188
- Forks
- 254
- PR merge metrics
- No merged PRs in 30d
Description
`teardownContext` is causing my tests to hang. I have an AJAX request that I expected to hit an endpoint but due to a programmer error in my test, I forgot to `await` the method that would hit the endpoint. This mean't the test ran to completion immediately and but the teardown would hang. After further investigation, I found the teardown could *never* complete because we remove the mechanism for updating the settled state values for pending requests.
https://github.com/emberjs/ember-test-helpers/blob/4ad756ee62ee6c87b1a9ec0e27a66bc5c3b092e7/addon-test-support/%40ember/test-helpers/teardown-context.ts#L36-L45
We call `_teardownAJAXHooks` which removes the listeners that will mutate `pendingRequests` and then we call `settled` which waits on the value of `pendingRequests` to change to zero. As a consequence of this, the tests hang until timeout.
Contributor guide
Assessment
This issue has not been assessed yet.