1

I have these two Ember integration tests, A and B. (I have a lot more, but in debugging this I have literally removed every other test in order to isolate the problem. There are 9 tests in the same file as A and I commented the other 8.) If A runs before B, B will fail. If B runs by itself, or before A, it will pass.

From this description it seems pretty clear that A is doing something to the test environment that screws up B. After liberally salting the tests and the production code involved with log messages, however, I'm no closer to figuring out what's up, and I'm hoping someone else can spot if there's an obvious issue.

Right now I'm looking closely at the afterEach blocks in both tests. Here's an outline of what the beforeEach and afterEach blocks look like for test A:

beforeEach: function() {
  server = new Pretender(function() {
    // Pretender setup removed for brevity
  });

  App = startApp();
},
afterEach: function() {
  server.shutdown();
  Ember.run(App, App.destroy);
}

That afterEach is pretty much the stock ember-cli code, but it baffles me a bit. The documentation on Ember.run() suggests it should get a function as an argument, but we're not giving it one here, so I'm not sure how that works. And, should the Pretender shutdown() call be inside the Ember.run (or in its own Ember.run)?

The versions, for the record: ember-cli 0.2.0, Ember 1.10.1.

ETA: The issue goes away when I update to ember-cli 0.2.3 and Ember 1.11.3. Now if only I could figure out the other failing tests we have with that update...

Community
  • 1
  • 1
pjmorse
  • 9,204
  • 9
  • 54
  • 124
  • We are using same callbacks and works fine, but we had very similar issue and couldn't find out what is going on. It depended on ember version - check out this issue - https://github.com/rwjblue/ember-qunit/issues/166 – Kuba Niechciał May 12 '15 at 14:34
  • This is interesting. We're in Ember 1.10, which is the version which worked for you, but we are seeing related failures in our branch trying to update to 1.11 - see http://stackoverflow.com/q/29566722/306084 – pjmorse May 12 '15 at 14:57
  • @JakubNiechciał post that comment as an answer, and I'll accept it; figuring out the update to Ember 1.11.3 made these tests pass, so I think you're right that this was a bug in ember-qunit which got addressed in a newer version. – pjmorse May 14 '15 at 19:22

1 Answers1

2

Your setup and teardown looks fine. They are commonly used and are properly defined.

However, there is (still) open issue on ember-qunit about not tearing down the app properly - take a look here to see the progress.

As you said, it does not happen in Ember 1.13.

Kuba Niechciał
  • 974
  • 7
  • 9