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

consider deprecating callbacks #14

Closed
cowboyd opened this issue Feb 6, 2015 · 6 comments
Closed

consider deprecating callbacks #14

cowboyd opened this issue Feb 6, 2015 · 6 comments

Comments

@cowboyd
Copy link

cowboyd commented Feb 6, 2015

describeModule and friends accept a list of callbacks. E.g.

describeModule('component:x-foo', 'TestModule callbacks', {
  beforeSetup: function() {},
  setup: function() {},
  teardown: function() { },
  afterTeardown: function() {}
, function() {
// spec body
})

After using ember mocha for a while, I feel that using the callbacks mechanism is unnecessary and a result of limitations in qUnit leaking through the shared interface. The reason is because, unlike qUnit, mocha has a generalized setup and teardown api in the form of before{All,Each} and after{All,Each} hooks, I have yet to encounter a situation where they have not sufficed.

While they could remain optional via, they feel counter to the mocha way and so should not occupy such a prime portion of API real-estate. At the very least, I think that the ember cli blueprints should generate idiomatic mocha code that does setup and teardown inside before and after hooks.

@rwjblue
Copy link
Member

rwjblue commented Feb 6, 2015

@cowboyd - As long as the context of {before,after}{All,Each} is the same as the it blocks (I believe it should already be true), then I'd say lets review a PR in ember-cli-mocha changing the blueprints...

@rwjblue
Copy link
Member

rwjblue commented Feb 6, 2015

Hmm, it seems that the beforeEach/afterEach (etc) callbacks do not get the same test context.

https://github.com/switchfly/ember-mocha/blob/master/lib/ember-mocha/mocha-module.js#L21-L37 is where the callbacks are setup, and it does not seem that we are overriding these to set the proper context.

@cowboyd
Copy link
Author

cowboyd commented Feb 6, 2015

It does as of #6,

I'll open an issue on ember-cli-mocha and see if I can get around to it at some point.

@rwjblue
Copy link
Member

rwjblue commented Feb 6, 2015

@cowboyd - Awesome, I did not see that. I think we should have some tests for #6 to ensure it works properly (I reviewed the tests to see if it were supported). For example I added some tests confirming context in emberjs/ember-test-helpers#12, maybe they could be used to ensure #6 does not have regressions...

@Turbo87
Copy link
Member

Turbo87 commented Nov 17, 2016

@cowboyd I think this can be considered solved, right? I'll close this, but feel free to reopen if I'm wrong!

@Turbo87 Turbo87 closed this as completed Nov 17, 2016
@cowboyd
Copy link
Author

cowboyd commented Nov 18, 2016

@Turbo87 Yes, I believe it is solved, and the blueprints have been updated for some time. Thanks!

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

No branches or pull requests

3 participants