-
-
Notifications
You must be signed in to change notification settings - Fork 69
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
Add waitForSettled support and use latests ember-test-helpers #633
base: master
Are you sure you want to change the base?
Conversation
* add capability to send waitForSettled option to the teardownContext function same as ember-qunit
update from upstream
* upgrade various dependencies * update ember-try list to include latest LTS versions * fix various deprecated features
* drop support for options in ember-cli-mocha namespace * update it-test * allow specifying options to the mocha runner
it looks like the new teardown in ember-test-helpers is working where this is no longer required
/** | ||
Ensures that `Ember.testing` is set to `true` before each test begins | ||
(including `before` / `beforeEach`), and reset to `false` after each test is | ||
completed. This is done via `beforeEach` and `afterEach`. | ||
*/ | ||
export function setupEmberTesting() { | ||
beforeEach(function() { | ||
Ember.testing = true; | ||
}); | ||
|
||
afterEach(function() { | ||
Ember.testing = false; | ||
}); | ||
} |
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.
We should not need to add this code. It should be handled by @ember/test-helpers
Also, before
should not have Ember.testing === true
, only while running an actual test (e.g. beforeEach
).
delete this[key]; | ||
} | ||
} | ||
|
||
// copy over the original values | ||
_assign(this, originalContext); | ||
Object.assign(this, originalContext); |
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.
Are we explicitly dropping IE11 support in this release? IMHO, that should be decoupled from updating @ember/test-helpers.
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 would the babel transpiler not handle this for us?
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 would the babel transpiler not handle this for us?
No, not by default. It is possible to configure this to transpile into core-js poly fills, but that requires the application has the polyfill installed/configured (which we can't assume). Additionally, we can't force the app to add the polyfill only in tests because then tests would pass in browsers that would never actually work in production/deployment.
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.
So unfortunately with the Proxy
solution in order to support the latest test-helpers we will either have to drop IE support or use https://github.com/GoogleChrome/proxy-polyfill. LMK if it still makes sense to decouple these.
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 let me know what you would like to do regarding this? Should I use the proxy-polyfill or should we just drop IE support in this PR?
@@ -17,6 +21,8 @@ module.exports = { | |||
rules: { | |||
'ember/new-module-imports': 'off', | |||
'ember/no-restricted-resolver-tests': 'off', | |||
'ember/no-test-import-export': 'off', | |||
'ember/no-ember-testing-in-module-scope': 'off' |
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.
We should not turn this rule off. The thing it is flagging is correct. Ember.testing
should never be set during module evaluation.
Will update and ping you. |
Update feature list to bring it inline with ember-qunit feature parity including
waitForSettled
option support, latesst ember-test-helpers support and update to use latest mocha.If you'd like to use these features now, This is from a maintained fork over https://github.com/yads/ember-mocha/