Since [email protected] / [email protected], Ember.testing
is only set to
true while a test is executing instead of all the time. Also, Ember.testing
is a
getter/setter in Ember and destructuring will only read its value at the time
of destructuring.
emberjs/ember-test-helpers#227
// Good
export default Component.extend({
someMethod() {
if (Ember.testing) {
doSomething();
} else {
doSomethingElse();
}
}
})
// Good
export default Service.extend({
foo() {
_bar(Ember.testing ? 0 : 400)
}
})
// Bad
export default Component.extend({
init() {
this.isTesting = Ember.testing
}
})
// Bad
import Ember from 'ember';
export default Ember.Component.extend({
isTesting: Ember.testing
})
// Bad
import Ember from 'ember';
const IS_TESTING = Ember.testing;
// Bad
import Ember from 'ember';
const { testing } = Ember;