0

Looking over the Ember CLI docs, it says to create an integration test like so:

import Ember from "ember";
import { module, test } from 'ember-qunit';
import startApp from '../helpers/start-app';
var App;

module('An Integration test', {
  beforeEach: function() {
    App = startApp();
  },
  afterEach: function() {
    Ember.run(App, App.destroy);
  }
});

test("Page contents", function(assert) {
  assert.expect(2);
  visit('/foos').then(function() {
    assert.equal(find('.foos-list').length, 1, "Page contains list of models");
    assert.equal(find('.foos-list .foo-item').length, 5, "List contains expected number of models");
  });
});

The problem is, this code results in:

TypeError: undefined is not a function

If I remove the test, I still get that error. If I remove the module, then I don't get the error. (But neither does qunit run the test.) This makes sense, because it looks like ember-qunit doesn't export a module.

So what am I suppose to do here?

nullnullnull
  • 8,039
  • 12
  • 55
  • 107
  • I had a similar problem and I bumped the versions of `ember-qunit` and `ember-cli-test-loader` in my `bower.json` and `ember-cli-qunit` in my `package.json` to the latest versions and the problem went was fixed. It's possible only one of those is needed though, but I don't quite remember. – Dhaulagiri Mar 04 '15 at 22:46
  • 1
    Actually, now I think I fixed this by switching to using ember-cli's built in acceptance tests to create the test file and for some reason that works differently than putting tests in an integration folder. – Dhaulagiri Mar 05 '15 at 00:28
  • 2
    Yes, that did the trick! The difference is that acceptance tests `import { module, test } from 'qunit'` rather than `ember-qunit`. – nullnullnull Mar 05 '15 at 00:55
  • Created a pull request to update the docs. Thanks again for your help! – nullnullnull Mar 05 '15 at 01:03
  • Nice! That makes sense. – Dhaulagiri Mar 05 '15 at 21:01

0 Answers0