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

Destructuring of Ember.testing will not work. #1476

Closed
rwjblue opened this issue Nov 14, 2017 · 4 comments · Fixed by #1477
Closed

Destructuring of Ember.testing will not work. #1476

rwjblue opened this issue Nov 14, 2017 · 4 comments · Fixed by #1477
Labels

Comments

@rwjblue
Copy link
Contributor

rwjblue commented Nov 14, 2017

Just happened to notice this:

https://github.com/simplabs/ember-simple-auth/blob/c295fee9b0bab6fdf7dcfca0cb706b68415caa95/addon/mixins/application-route-mixin.js#L10

Which is used here:

https://github.com/simplabs/ember-simple-auth/blob/c295fee9b0bab6fdf7dcfca0cb706b68415caa95/addon/mixins/application-route-mixin.js#L141-L149

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 [email protected] / [email protected]).

I believe the fix here would be to remove the destructuring, and use Ember.testing directly inline.

@rwjblue
Copy link
Contributor Author

rwjblue commented Nov 14, 2017

FYI - This is likely to bite folks updating to the latest ember-cli-qunit version (4.1.1)...

@marcoow
Copy link
Member

marcoow commented Nov 14, 2017

Thanks for the notice!

@Turbo87
Copy link
Collaborator

Turbo87 commented Dec 6, 2017

FWIW this will also be an issue for the next release of ember-cli-mocha. We should probably release this soon :)

@Turbo87 Turbo87 added the bug label Dec 6, 2017
bgentry added a commit to ember-graphql/ember-apollo-client that referenced this issue Dec 17, 2017
Module destructures are evaluated at build time, but this value is
changed dynamically at runtime. Avoiding the destructure is the only way
to work given this behavior. See these issues:

mainmatter/ember-simple-auth#1476
emberjs/ember-test-helpers#227
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants