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
Remove exception
method from QUnit test adapter.
#307
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
|
@@ -24,7 +25,7 @@ function unhandledRejectionAssertion(current, error) { | |
}); | ||
} | ||
|
||
export default Ember.Test.Adapter.extend({ | ||
let Adapter = Ember.Test.Adapter.extend({ | ||
init() { | ||
this.doneCallbacks = []; | ||
}, | ||
|
@@ -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)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this condition sounds like it would only work for 2.17, but I'm assuming the same is true for 2.18? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
Adapter = Adapter.extend({ | ||
exception(error) { | ||
unhandledRejectionAssertion(QUnit.config.current, error); | ||
}, | ||
}); | ||
} | ||
|
||
export default Adapter; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is that helper public API?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its effectively public, its basically in the same state as
wait
was before. Lots of folks use it, but we haven't officially said its "public".I'll open a PR to export it from the entry point...