-
-
Notifications
You must be signed in to change notification settings - Fork 155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to test Ember.onError
after upgrading
#250
Comments
I think the best way to do this is: // tests/qunit-adapter.js
import { QUnitAdapter } from 'ember-qunit';
let useEmberOnError = false;
export default QUnitAdapter.extend({
exception(error) {
if (useEmberOnError) {
Ember.onerror(error);
return;
}
this._super(...arguments);
}
}) // tests/test-helper.js
/* existing contents */
import QUnitAdapter from './qunit-adapter';
Ember.Test.adapter = QUnitAdapter.create(); |
FWIW, I think ^ was also the best way to do this before ember-qunit@2 too. |
@rwjblue Okay, yea. I think I just needed to reorient my thinking on this. Overriding the adapter in this way feels natural to me. The globals just make things seem wonky sometimes. I think the one catch is you have to be careful when you set the global adapter so that it's done after the test-loader sets it. It seems like |
Now with the
|
Thanks, @kbullaughey! This worked for me when testing backend error responses. |
I'm in the process of upgrading to ember 2.10. One of the packages upgraded was
ember-cli-qunit
which in turn upgradesember-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 thetest-loader
bundled withember-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:
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.The text was updated successfully, but these errors were encountered: