Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Destructuring of Ember.testing will not work. #332

Closed
rwjblue opened this issue Dec 17, 2017 · 2 comments
Closed

Destructuring of Ember.testing will not work. #332

rwjblue opened this issue Dec 17, 2017 · 2 comments

Comments

@rwjblue
Copy link
Member

rwjblue commented Dec 17, 2017

Ember.testing is a getter/setter in Ember, and destructuring like this will only read its value at the time the module is evaluated. In this case, Ember.testing will most likely be false when the module is evaluated, then change to true during the test. This behavior somewhat recently changed in emberjs/ember-test-helpers#227 (which is included in ember-cli-qunit@4.1.0 / ember-qunit@3.0.0).

const { Logger, Test, testing } = Ember;

if (testing) {
Test.registerWaiter(function() {
return pendingRequestCount === 0;
});
}

@alexlafroscia
Copy link
Collaborator

I see, so we should always use Ember.testing. I can definitely update that.

Is there a new API being introduced for the new @ember/__MODULE__ syntax?

@rwjblue
Copy link
Member Author

rwjblue commented Dec 18, 2017

Yes, there will be a non-globals API, but we just need to decide the actual module path and pull the trigger.

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

No branches or pull requests

2 participants