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

You attempted to access the isNamespace property (of service:features) #89

Open
Leooo opened this issue Mar 9, 2020 · 2 comments
Open

Comments

@Leooo
Copy link

Leooo commented Mar 9, 2020

Seeing this error in tests on Ember >= 3.4 when using withFeature helper:

You attempted to access the isNamespace property (of service:features)

Fixed it by extending the features service in the app with:

///app/services/features.js
import FeaturesService from 'ember-feature-flags/services/features';
import config from '../config/environment';

export default FeaturesService.extend({
  config,
  init() { //see https://github.com/kategengler/ember-feature-flags/blob/06b33fd5d6e78538c8611cdf134e93adc3a04e71/app/services/features.js
    this._super(...arguments);
    if (config.featureFlags) {
      this.setup(config.featureFlags);
    }
  },
  unknownProperty(key) {
    if (key === 'isNamespace') {
      return null; //see https://github.com/emberjs/ember.js/issues/16521#issuecomment-382465594 (need `null` or `undefined`)
    }
    return this._super(...arguments);
  }
@kategengler
Copy link
Owner

Hi! Are you still using "old" style acceptance tests? These would have moduleForAcceptance etc?

If not, you should use the enableFeature test helper https://github.com/kategengler/ember-feature-flags#enablefeature

@Leooo
Copy link
Author

Leooo commented Mar 10, 2020

yes indeed, it's on Ember 3.4 with old-style acceptance tests - want to keep the upgrade of Ember and of test module suites separate on this one.

That was also my guess that it would disappear with new test syntax, still worth mentioning it in here in case someone else bumps into that. Noted that https://github.com/kategengler/ember-feature-flags#enablefeature will be the way to go in the future thanks.

Happy to close if nothing to be done on this one, let me know.

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