Unable to test `Ember.onError` after upgrading
See original GitHub issueI’m in the process of upgrading to ember 2.10. One of the packages upgraded was ember-cli-qunit
which in turn upgrades ember-qunit
to 2.0. One problem that I’m faced with is that I am now unable to acceptance test my application’s error handling (which is oddly complex and important to test).
The problem is that ember-qunit
now providers their own test adapter (See: ember-qunit#234). And the test-loader
bundled with ember-cli-qunit
just imports it, instanitaties it and set’s it as global (See: ember-cli-qunit#134).
Before this upgrade I would just do the following:
let useEmberOnError = false;
Ember.Test.QUnitAdapter.reopen({
exception(error) {
if (useEmberOnError) {
Ember.onerror(error);
return;
}
this._super(...arguments);
}
});
But now I’m no longer able to monkey patch this. I think I could probably replace the Ember.Test.adapter
instance with my own, but this feels brittle. I’m curious what you guys think the “right solution” might be to acceptance test application error handling.
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
I think the best way to do this is:
start({setupTestAdapter: false});
Thanks, @kbullaughey! This worked for me when testing backend error responses.