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

[BUGFIX release] ensure testHelpers are removed when the app is destr… #11864

Merged

Conversation

stefanpenner
Copy link
Member

…oyed

@stefanpenner stefanpenner force-pushed the ensure-test-helpers-are-auto-cleanedup branch from 1609a9b to 876aeea Compare July 22, 2015 23:38
mixonic added a commit that referenced this pull request Jul 23, 2015
…uto-cleanedup

[BUGFIX release] ensure testHelpers are removed when the app is destr…
@mixonic mixonic merged commit 665c733 into emberjs:master Jul 23, 2015
@stefanpenner stefanpenner deleted the ensure-test-helpers-are-auto-cleanedup branch July 23, 2015 16:18
@cibernox
Copy link
Contributor

I have a bug in my test suite using ember from components/ember#release and I think it's because of this PR.

I'm using ember-simple-auth in my afterEach hooks to ensure I clear the session after each example:

  afterEach: function() {
    invalidateSession();
    Ember.run(application, 'destroy');
  }

The exceptions I'm getting is TypeError: wait is not a function from https://github.com/simplabs/ember-simple-auth/blob/6eec0d10a2287dbb2b8067a3deb9a4db099860a9/packages/ember-simple-auth-testing/lib/simple-auth-testing/test-helpers.js#L20

My initial guess is that the invalidation of the session is async but the app is destroyed synchronously using Ember.run and the helpers are destroyed before I the test-helper does it's job.

Using Ember.run(invalidateSession); instead fixes the error.

Would forcing a flush in the run loop before destroying the app be a solution for other people using ember-simple-auth? Or is responsabily of each library to fix this?

@stefanpenner
Copy link
Member Author

Sounds like you need to create a promise chain with invalidate session that prevents deletion until it is complete.

I'm not familiar with how that lib works, but if it needs to truly do something async to invalidate the session the run won't help. I believe my above recommendation is likely the solution.

@cibernox
Copy link
Contributor

I'll open an issue in ember-simple-auth to make people aware of this and continue the discussion there.

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.

3 participants