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

Async behavior outside of a test #246

Closed
trentmwillis opened this issue Oct 27, 2016 · 5 comments
Closed

Async behavior outside of a test #246

trentmwillis opened this issue Oct 27, 2016 · 5 comments

Comments

@trentmwillis
Copy link
Member

Due to the way RSVP is configured in testing environments and the way ember-qunit's adapter works, it is impossible to define RSVP-based async behavior outside of a test.

As an example, if we want to load some assets before the test run (as we do for ember-engines, currently) then you'll get an error, because QUnit.config.current will be undefined at the moment in which you create an RSVP.Promise.

One option is to move that request into the beforeEach hook of the test module, but this is problematic because if you're attempting to preload assets (as in the above case), it is possible that you need to load the asset to prevent one of the other tests from erring out when requiring it.

I have two proposed solutions:

  1. Set Ember.testing to false until QUnit.start() is invoked.
  2. Configure RSVP from this addon to only use asyncStart/asyncEnd when QUnit.config.current exists.

All of this said, I am a bit confused as to why we configure RSVP at all. I think this pattern is likely masking bad asynchronous tests and should be done away with, if possible.

@rwjblue
Copy link
Member

rwjblue commented Oct 17, 2017

Totally agreed RE: point 1, I'll make the change in ember-test-helpers...

@rwjblue
Copy link
Member

rwjblue commented Oct 18, 2017

emberjs/ember-test-helpers#227 should address

@rwjblue
Copy link
Member

rwjblue commented Oct 19, 2017

@trentmwillis - Do you think the changes in emberjs/ember-test-helpers#227 are enough to close this, or should we also continue to figure out your second proposal as well?

@trentmwillis
Copy link
Member Author

@rwjblue I believe that should fix it

@rwjblue
Copy link
Member

rwjblue commented Oct 20, 2017

Thank you sir!

@rwjblue rwjblue closed this as completed Oct 20, 2017
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

No branches or pull requests

2 participants