Skip to content
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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

yads
Copy link

@yads yads commented Feb 14, 2021

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/

yads and others added 7 commits February 13, 2020 13:31
* add capability to send waitForSettled option to the teardownContext function same as ember-qunit
* 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
Comment on lines +13 to +26
/**
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;
});
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete this[key];
}
}

// copy over the original values
_assign(this, originalContext);
Object.assign(this, originalContext);
Copy link
Member

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.

Copy link
Author

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?

Copy link
Member

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.

Copy link
Author

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.

Copy link
Author

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'
Copy link
Member

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.

@yads
Copy link
Author

yads commented Feb 15, 2021

Will update and ping you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants