elwayman02 / ember-sinon-qunit

Sinon sandbox test integration for QUnit
MIT License
58 stars 30 forks source link

How to use? #47

Closed hoIIer closed 8 years ago

hoIIer commented 8 years ago

Hello,

I have installed this and then done the following but it doesn't seem to be importing...

import { moduleFor } from 'ember-qunit'
import test from 'clientweb/tests/ember-sinon-qunit/test'

moduleFor 'service:wamp', {}

# Replace this with your real tests.
test 'it gets a new connection when `initiate` method is called', (assert)->
  service = @subject()
  debugger
  assert.ok service

why is the import app/tests/ember-sinon-qunit/test ? that folder doesnt exist

elwayman02 commented 8 years ago

@erichonkanen the latest release runs into an ember-cli bug. Make sure you have ember-sinon 0.5.1 included as a dependency in your app, in addition to ember-sinon-qunit. Otherwise the imports will fail, as sinon does not get setup correctly.

The import you are asking about comes from here. When ember-cli merges the addon with your app, it moves the test-support files to your-app-name/tests/ember-sinon-qunit

elwayman02 commented 8 years ago

I've just released v1.3.3 to re-add the blueprint that adds ember-sinon to your app; sorry about that!

hoIIer commented 8 years ago

hey @elwayman02 thanks for updating, do I need to run any ember generate type commands after running ember install ember-sinon-qunit? I ran that but I dont see the folder showing up

elwayman02 commented 8 years ago

@erichonkanen you won't see the folder show up in your app. Ember-cli only adds them at build time, which means that when you run ember test, the file will automagickally be there!

hoIIer commented 8 years ago

I see, do I still need to have that dependency on ember-sinon after your last release?

hoIIer commented 8 years ago

here is my test:

import { moduleFor } from 'ember-qunit'
import test from 'clientweb/tests/ember-sinon-qunit/test'

moduleFor 'service:wamp', 'Unit | Service | wamp', {}

test 'it gets a new connection when `initiate` method is called', (assert)->
  service = @subject()
  debugger
  assert.ok service

here is the command Im running (Im trying to load it in a browser because I wanted to poke around via debugger to get better idea of some things... / new to unit testing in ember)

docker run --rm -p 4200:4200 clientweb ember test --server --test-port 4200 --module "service:wamp"

seems like it's not importing though

elwayman02 commented 8 years ago

Yes, you will still need the dependency on ember-sinon. This is due to an upstream bug in ember-cli that won't be fixed until ember-cli 2.7 (which is not released yet).

hoIIer commented 8 years ago

ok got it thanks!