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 resetOnerror from @ember/test-helpers #310

Merged
merged 2 commits into from
Feb 7, 2019

Conversation

scalvert
Copy link
Contributor

@scalvert scalvert commented Feb 2, 2019

This PR is paired with the new @ember/test-helpers API (setupOnerror/resetOnerror) for providing an Ember.onerror implementation (emberjs/ember-test-helpers#548). This adds automatic wiring up of resetOnerror with mocha's root module afterEach, so we ensure that the Ember.onerror function is reset after each test.

@rwjblue
Copy link
Member

rwjblue commented Feb 2, 2019

On the surface, the CI failure seems unrelated. I’ll trigger a master build to confirm.

@rwjblue rwjblue requested a review from Turbo87 February 2, 2019 18:40
@rwjblue
Copy link
Member

rwjblue commented Feb 2, 2019

@scalvert
Copy link
Contributor Author

scalvert commented Feb 2, 2019

Ya I don't really understand the failure. It appears to imply that we need to use the async done callback, but I'm not sure why. resetOnerror is sync, so I don't understand what's happening.

I'm going to debug a bit to understand.

@scalvert
Copy link
Contributor Author

scalvert commented Feb 2, 2019

OK, so updated the code to not pass resetOnerror as a ref to afterEach. This seems to have addressed the issue.

function setupResetOnerror() {
  afterEach(function() {
    resetOnerror();
  });
}

@rwjblue
Copy link
Member

rwjblue commented Feb 2, 2019

Ya, that makes sense. Mocha checks function arity to decide if it needs to pass in and wait on the done callback.

@Turbo87 Turbo87 merged commit 945dcee into emberjs:master Feb 7, 2019
@Turbo87
Copy link
Member

Turbo87 commented Feb 7, 2019

thanks :)

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

Successfully merging this pull request may close these issues.

3 participants