[resolved] Why does this call to Ember.run break in tests?

Ember.run.schedule("actions", this, function () {
  this.set('totalsChartComponent', undefined);
Ember.run.next(this, function () {
  this.set('totalsChartComponent', "ember-chart");

I want this code to run sequentially in two separate run loops so I used schedule and next to achieve that.

I understand that asynchronous stuff generally need to be wrapped in an Ember.run to be interpreted correctly in a test environment but all of this code is inside of an Ember.run.

Still, I get: Error: Assertion Failed: You have turned on testing mode, which disabled the run-loop’s autorun. You will need to wrap any code with asynchronous side-effects in a run

I’m not sure how to fix this as simply wrapping the whole thing in an ember run does not fix this and actually breaks the whole thing.

So how can I make this run or should I not be doing this schedule/next pattern in the first place?


I jumped the gun and overlooked something obvious. I thought some magical thing I didn’t understand in the run loop had broken because I am scared of the run loop. In reality the only thing broken about my code was that ‘this’ was not being used in the correct context after adding the run loop.