Skip to content

Commit

Permalink
Merge pull request #307 from emberjs/remove-adapter-exception
Browse files Browse the repository at this point in the history
Remove `exception` method from QUnit test adapter.
  • Loading branch information
rwjblue committed Jan 17, 2018
2 parents a3c95ae + d651517 commit 5382730
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions addon-test-support/ember-qunit/adapter.js
@@ -1,5 +1,6 @@
import Ember from 'ember';
import QUnit from 'qunit';
import hasEmberVersion from '@ember/test-helpers/has-ember-version';

function unhandledRejectionAssertion(current, error) {
let message, source;
Expand All @@ -24,7 +25,7 @@ function unhandledRejectionAssertion(current, error) {
});
}

export default Ember.Test.Adapter.extend({
let Adapter = Ember.Test.Adapter.extend({
init() {
this.doneCallbacks = [];
},
Expand All @@ -40,8 +41,18 @@ export default Ember.Test.Adapter.extend({
done();
}
},

exception(error) {
unhandledRejectionAssertion(QUnit.config.current, error);
},
});

// Ember 2.17 and higher do not require the test adapter to have an `exception`
// method When `exception` is not present, the unhandled rejection is
// automatically re-thrown and will therefore hit QUnit's own global error
// handler (therefore appropriately causing test failure)
if (!hasEmberVersion(2, 17)) {
Adapter = Adapter.extend({
exception(error) {
unhandledRejectionAssertion(QUnit.config.current, error);
},
});
}

export default Adapter;

0 comments on commit 5382730

Please sign in to comment.