How to catch errors in component/rendering test?

This is a bug we are trying to get fixed. The work around is something like this:

module('my-component test', function(hooks) {
    setupRenderingTest(hooks);

    test('throws', function(assert) {
      Ember.onerror = function(error) {
        // make your error assertion here
      };
      await render(hbs`{{my-component}}`) 
    });
});

This is obviously not ideal, follow along here:

https://github.com/emberjs/ember-test-helpers/issues/310

3 Likes