-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Update Test adapter to support QUnit 2.0 #13696
Comments
I found a way to invoke visit('/post/').then(() => assert.ok(true, 'visited post')); This is essentially executed as: var done = assert.async();
doActualVisit().then(done).then(() => assert.ok(true, 'visited post')); Since the final assertion comes after the cc @leobalter for any additional insight on potential solutions |
@trentmwillis does your solution recommend a change to the test adapter API? With Using export default Adapter.extend({
asyncStart() {
QUnit.stop();
},
asyncEnd() {
QUnit.start();
},
exception(error) {
ok(false, inspect(error));
}
}); This seems like the use case for function helper(app, name) {
let fn = helpers[name].method;
let meta = helpers[name].meta;
if (!meta.wait) {
return (...args) => fn.apply(app, [app, ...args]);
}
return (...args) => {
let lastPromise = run(() => resolve(getLastPromise()));
// wait for last helper's promise to resolve and then
// execute. To be safe, we need to tell the adapter we're going
// asynchronous here, because fn may not be invoked before we
// return.
asyncStart();
return lastPromise.then(() => fn.apply(app, [app, ...args])).finally(asyncEnd);
};
} |
@pixelhandler I don't currently have a solution. The one solution I did have, fails in the use case I describe above. The only way that |
@trentmwillis yes seems like there needs some discussion as to a path ahead regarding QUnit 2.0 I'm curious if this should be an RFC issues as this is not technically an Ember.js bug. |
@trentmwillis Actually the discussion may be better if added to the thread on the "Grand Testing Unification RFC" - https://github.com/rwjblue/rfcs/blob/42/text/0000-grand-testing-unification.md#async--await Seems that the proposal does not mention It may be the case that the testing suite may not use QUnit 2 until that above propose is settled. Perhaps continue discussion on the topic of the API for test adapter on that RFC. |
@trentmwillis this issue is also related: #10484 |
I have pulled together a potential fix in #13702. I don't think this is the best possible solution, but I don't think a "best" solution would be possible without some larger rethinking of how tests handle async currently. I am definitely onboard with the Grand Testing Unification RFC and I think the whole |
Closing this, ember-cli-qunit@3.0 uses ember-qunit@1.0.0-beta.1 which includes and updated QUnit adapter that is compatible with QUnit 2.0. |
QUnit 2.0 was released today, yay! But, unfortunately, Ember's test adapter for QUnit currently relies on
QUnit.stop
which has been removed. The recommended upgrade path is to useassert.async()
which works for most cases, but since theasyncStart
of the test adapter is invoked behind an abstraction, passing through theassert
object might be a bit difficult.Opening this up for some discussion on thoughts to get around this. I have a few thoughts but they all seem too hacky right now.I believe I have a solid solution, will open a PR soonish.The text was updated successfully, but these errors were encountered: