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

Exporting QUnit.push #140

Closed
e00dan opened this issue Feb 15, 2015 · 3 comments
Closed

Exporting QUnit.push #140

e00dan opened this issue Feb 15, 2015 · 3 comments

Comments

@e00dan
Copy link
Contributor

e00dan commented Feb 15, 2015

Is there any way to call QUnit.push() without using global variable or is it ok to use QUnit without using import. I'm asking because following approaches don't work(push is not exported from qunit.js and ember-qunit.js`:

`import { push } from 'qunit'`

or

`import { push } from 'ember-qunit'`

So I have to use QUnit.push() instead of importing method and using push().
Will you support this? It seems intuitive.

@rwjblue
Copy link
Member

rwjblue commented Feb 15, 2015

@rwjblue
Copy link
Member

rwjblue commented Feb 15, 2015

I'd definitely suggest following the QUnit 2.x way of this, but you can import the global via:

import QUnit from 'qunit';

@rwjblue rwjblue closed this as completed Feb 15, 2015
@e00dan
Copy link
Contributor Author

e00dan commented Feb 15, 2015

Ok, I refactored my approach to use this.push, now I'm confused where should QUnit.assert extensions/additional methods should be put. I've searched through Ember CLI blueprints but couldn't find anything related to it. Maybe Ember CLI should provide convention where to store such extensions to assert similiar to helpers - or should this be placed in helpers directory? I guess all my questions come from lack of documentation on Ember QUnit 2.0 testing approaches. Could this.push() be called in Ember.Test.registerAsyncHelper?

Currently I'm storing my extension to assert in my-route-test file:

QUnit.assert.will = (promise, message) ->
  promise.then =>
    @push true, undefined, undefined, message
  , =>
    @push false, undefined, undefined, 'promise rejected (but should have been resolved)'

I guess there is a better approach.

#edit
Ok for now I've created helpers/assertions.coffee and I store there my custom assertions.

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

2 participants