I'm extending the intl service in my addon but when I try to access it in the tests I can only access the original service. However it works when consuming it in the app. It also worked when I had it extended in the app so the issue is only in the addon.
import Service from 'ember-intl/services/intl';
export default Service.extend({
currentLocale: 'en'
});
Extend the intl service in the addon and add a simple attribute like currentLocale: 'en'. Try to access that in the dummy app. Also try to access it in an integration test like
let service = this.owner.lookup('service:intl');
service.currentLocale
Also accessing the intl service in unit tests work only like this
import IntlService from 'my-addon/services/intl';
let service = IntlService.create(this.owner.ownerInjection());
ember-intl does not do anything out of the ordinary in registering the service.
You likely need to tell ember-cli to use your addon's app tree over ember-intl's app tree. Right now, it just sounds like ember-intl's app tree is winning out.
That can be fixed in your addon's package.json via:
{
"ember-addon": {
"after": ["ember-intl"]
}
}
If this doesn't resolve it, I'd need a working reproduction of the issue that I can clone and look at.
Thanks a lot, this was exactly the issue and it's now solved 馃檱 Closing...
Most helpful comment
ember-intl does not do anything out of the ordinary in registering the service.
You likely need to tell ember-cli to use your addon's app tree over ember-intl's app tree. Right now, it just sounds like ember-intl's app tree is winning out.
That can be fixed in your addon's
package.jsonvia:If this doesn't resolve it, I'd need a working reproduction of the issue that I can clone and look at.