-
Notifications
You must be signed in to change notification settings - Fork 184
Issue using ember-i18n in qunit 4.2.1 and ember-cli version 2.18.2 #483
Comments
Have you read https://github.com/jamesarosen/ember-i18n/wiki/Doc:-Testing ? |
Yes, that's what I am trying to follow.
…On Thu, Apr 12, 2018 at 12:49 PM, James Alexander Rosen < ***@***.***> wrote:
Have you read https://github.com/jamesarosen/ember-i18n/wiki/Doc:-Testing
?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#483 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/APYKyVZnE1jXapI8QGh7a0jYd8iBiQO_ks5tn6G7gaJpZM4TSR4J>
.
|
Yes. That is what I mentioned when I showed the import --- are there other steps missing? (I notice t is defined) |
Not expected.
Possibly. It's also possible that ember-i18n's guides for using RFC232/RFC268 tests are wrong. Perhaps you could share more of your test file. |
On thing that is different (although I tried using module), is we are using moduleForAcceptance to setup the qunit tests. The test itself is pretty simple. in moduleForAcceptance('Acceptance | dashboard', { test('Networks title', async function(assert) { ember 2.18 still generates "qunit stubs" that use moduleForAcceptance. I wonder if that's part of the issue. In my start-app.js helper I do: Then in our module-for-acceptance.js helper, it's pretty boiler-plate. this.application= startApp(); |
You're using an "old-style" acceptance test, not an RFC268-style test. That means you should follow this section. Specifically, you should have // tests/helpers/start-app.js
import './ember-i18n/test-helpers'; and shouldn't have |
I am okay with you closing this, however, I still get the "assert" that owner isn't defined. I am going to back down to qunit 4.1.1 to see if using the "old" way works as you suggestion. Thank you. |
I didn't expect that! Do please document your findings here. We can add them to the wiki once you figure out what's going on. |
I should note, this all worked prior to upgrading to ember 2.18.2 I am now trying with Qunit 4.1.1 -- I can change this out if I should go to 4.2.1 In my start-app.js file, I added:
import './ember-i18n/test-helpers'; Here is what I have so far. In my "test", I am setting it up like this: import { tHelper } from 'ember-i18n/helper';
import { getOwner } from '@ember/application';
moduleForAcceptance('Acceptance | dashboard', {
beforeEach() {
getOwner(this).lookup('service:i18n').set('locale', 'en');
this.register('helper:t', tHelper);
... First, eslint fails because of so.. I tried removing that call. So.. those steps are not working as expected. |
You can add |
okay. I backed qunit down to version 4.1.1. I removed all the register stuff and simply added the import to start-apps. I added t: true to globals of .eslintrc.js and now I have it working. Thank you for your help! (I would close this, but realize there may be an issue with 4.2.1 using the old way.) |
jamesarosen/ember-i18n has been deprecated in favor of ember-intl. |
I am possibly doing something wrong in configuring this, but I have tried to follow the documents for setting up i18n for tests. In my qunit file, I have:
import { t } from 'ember-i18n/test-support';
In my test I am using t('common.testText')...
assert.equal(page.title, t('common.testText');
But.. when the test executes, function t() fails, because the "getContext" call returns undefined, thus owner is undefined. Is that an expected case that should be handled? And/Or is this a setup issue?
The text was updated successfully, but these errors were encountered: