Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Beta] regression in integration tests w/ async ember-data relationships #233

Closed
simonihmig opened this issue Dec 7, 2017 · 3 comments · Fixed by emberjs/ember-test-helpers#263

Comments

@simonihmig
Copy link
Contributor

@Turbo87 this is the regression I mentioned yesterday on Slack. I finally got a minimal reproduction together: https://github.com/simonihmig/ember-mocha-demo

The failing test is this one: https://github.com/simonihmig/ember-mocha-demo/blob/master/tests/integration/components/my-component-test.js#L39-L42.

In the beforeEach I load a model parent, that has an async relationship to child. The loading of the child happens in the template: https://github.com/simonihmig/ember-mocha-demo/blob/master/app/templates/components/my-component.hbs#L4.
The test itself is passing, but some async callback of ember-data seems to run after the test has finished, causing a set on destroyed object error:

image

The following screenshot shows the _find function which seems to load the child record. As you can see this happens before the test's assertion:

image

The other breakpoint is within the then callback, and this happens after the assertion, and apparently after the test has been teared down, as the call to serializerForAdapter is causing the afore mentioned exception (the jsonapi serializer has already been destroyed, when it tries to set the store on it):

image

Adding await wait() fixes this: https://github.com/simonihmig/ember-mocha-demo/blob/master/tests/integration/components/my-component-test.js#L39-L42. So seems there is still some pending promise or run loop that is not correctly waited for before tearing down the test?

Also, when downgrading to 0.14.4 this error does not show up. As you said already, the root issue might be caused by the larger upstream changes in ember-test-helpers, but I filed this here for now...

@rwjblue
Copy link
Member

rwjblue commented Dec 13, 2017

@simonihmig - Can you confirm that emberjs/ember-test-helpers#263 (which was released in @ember/test-helpers@0.7.4) fixes your real app also?

@simonihmig
Copy link
Contributor Author

@rwjblue sure, wanted to do that already, but didn't find the time yet. Hopefully tomorrow, will keep you updated!

@simonihmig
Copy link
Contributor Author

@rwjblue all tests are ✅ ✅ ✅ 👏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants