-
-
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 ember-testing tests to new syntax #16022
Update ember-testing tests to new syntax #16022
Conversation
['@test asyncStart calls stop'](assert) { | ||
var originalStop = QUnit.stop; | ||
try { | ||
QUnit.stop = function() { |
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.
I'm not very sure what to do about QUnit.stop
and QUnit.start
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.
The places that are explicitly testing asyncStart
and asyncStop
should continue to use QUnit.stop
/ QUnit.start
for now, but anywhere else it is being done should be migrated to assert.async()
.
} finally { | ||
QUnit.start = originalStart; | ||
['@test asyncEnd calls start'](assert) { | ||
var originalStart = QUnit.start; |
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.
Again
var error = { err: 'hai' }; | ||
var originalOk = window.ok; | ||
try { | ||
window.ok = function(val, msg) { |
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.
This is also unclear.
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.
I have some tests for this in ember-qunit, basically you should do:
let originalPushResult = assert.pushResult;
assert.pushResult = function(resultInfo) {
// Inverts the result so we can test failing assertions
resultInfo.result = !resultInfo.result;
resultInfo.message = `Failed: ${resultInfo.message}`;
originalPushResult(resultInfo);
};
return new RSVP.Promise(function(resolve) { | ||
QUnit.stop(); // raw async, we must inform the test framework manually | ||
setTimeout(function() { | ||
QUnit.start(); // raw async, we must inform the test framework manually |
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.
again
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.
Should use assert.async();
here
@cibernox - Had any time to work on this? |
I do now. TBH, i just forgot about this PR 😅 |
d7be5d5
to
b9a40bb
Compare
@@ -18,6 +18,6 @@ export default Adapter.extend({ | |||
QUnit.start(); | |||
}, | |||
exception(error) { | |||
ok(false, inspect(error)); | |||
ok(false, inspect(error)); // How do we access assert.ok here? |
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.
@rwjblue Should I use QUnit.assert.ok
here instead?
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.
QUnit.config.current.assert.ok
bc34812
to
ca004d3
Compare
@rwjblue ready |
Part of #15988