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

Set Ember.testing only while actually running a test. #227

Merged
merged 1 commit into from
Oct 18, 2017

Conversation

rwjblue
Copy link
Member

@rwjblue rwjblue commented Oct 18, 2017

Previously, Ember.testing was set to true in module scope of ember-test-helpers module. This causes issues due to how Ember handles RSVP promises that happen while Ember.testing is truthy.

This commit updates the various machinery to set Ember.testing = true when tests are starting, and reset it to false once they've finished their teardown. It also adds assertions to ensure that each test properly cleans up after itself.

Note: In some cases, instead of adding new assertions I used throw new Error(). This was only done in the "legacy" tests as a way of ensuring the required functionality without modifying all assert.expect() counts throughout those test files.

Partially addresses emberjs/ember-qunit#246.

Previously, `Ember.testing` was set to `true` in module scope of
`ember-test-helpers` module. This causes issues due to how Ember
handles RSVP promises that happen while `Ember.testing` is truthy.

This commit updates the various machinery to set `Ember.testing =
true` when tests are starting, and reset it to `false` once they've
finished their teardown. It also adds assertions to ensure that each
test properly cleans up after itself.

Note: In some cases, instead of adding new assertions I used `throw
new Error()`. This was only done in the "legacy" tests as a way of
ensuring the required functionality without modifying all
`assert.expect()` counts throughout those test files.
Copy link
Member

@Turbo87 Turbo87 left a comment

Choose a reason for hiding this comment

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

seems good :)

@rwjblue rwjblue merged commit ae782bf into emberjs:master Oct 18, 2017
@rwjblue rwjblue deleted the ember-testing branch October 18, 2017 13:03
bgentry added a commit to ember-graphql/ember-apollo-client that referenced this pull request Dec 17, 2017
Module destructures are evaluated at build time, but this value is
changed dynamically at runtime. Avoiding the destructure is the only way
to work given this behavior. See these issues:

mainmatter/ember-simple-auth#1476
emberjs/ember-test-helpers#227
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants