ember-mocha: Component tests run fine if in the 'root' describe block, but throw 'You have turned on testing mode, which disabled the run-loop's autorun' error when in nested describe blocks

The following pseudo code works fine:

describe('Unit | Component | common | input-with-validation', function() {
  setupComponentTest('componentToTest', {
    needs: [],
    unit: true
  });
  beforeEach(function () {
    component = this.subject();
  });

  it('Test Observer', function() {
    component.set('observedKey', true);
  }
}

but the following does not, and raises an assertion error: 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

describe('Unit | Component | common | input-with-validation', function() {
  setupComponentTest('componentToTest', {
    needs: [],
    unit: true
  });

  beforeEach(function () {
    component = this.subject();
  });

  describe('Observers', function () {
    it('Test Observer', function() {
      component.set('observedKey', true);
    }
  }
}

About this issue

  • Original URL
  • State: open
  • Created 7 years ago
  • Reactions: 3
  • Comments: 15 (4 by maintainers)

Most upvoted comments

I just reproduced this in our app. Here is an example test that reproduces the error: https://github.com/efx/ember-mocha/commit/560abc959fe70abd8baf8313eeecb055117aebe0

@rreckonerr I deleted my fork and that work; apologies! I will take a look later today to see if I have a copy locally. I reduced the example to the most basic form. You should be able to see the issue by simply nesting the 2nd describe in the first one. For the record, our team avoids nesting describe blocks in our ember application because of this.