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. #21

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

Destructuring of Ember.testing will not work. #21

rwjblue opened this issue Dec 17, 2017 · 2 comments

Comments

@rwjblue
Copy link

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).

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

const {
computed,
Service,
inject,
RSVP: { Promise },
get,
merge,
copy,
typeOf: getTypeOf,
Evented,
isNone,
Logger,
testing
} = Ember;

if (testing) {
return;
}

@arm1n
Copy link
Collaborator

arm1n commented Dec 18, 2017

Thanks a lot for this hint, we're currently working on version 1.0.0 using latest Ember with new modules API and hope to have import { isTesting, setTesting } from '@ember/test' available as soon as possible (ember-cli/ember-rfc176-data#12), then this issue should be gone anyways.

arm1n added a commit that referenced this issue Dec 18, 2017
arm1n added a commit that referenced this issue Dec 18, 2017
@mydea
Copy link
Contributor

mydea commented Aug 7, 2020

This is not used anymore, so I'm closing this!

@mydea mydea closed this as completed Aug 7, 2020
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

3 participants