Using chai-qunit on top of ember-cli's ember-qunit?


#1

I’m trying to do some testing for my ember-cli application. As I understand the default testing framework is qunit, but I would like to use chai-qunit on top of it. Unfortunately I’m really new to javascript and ES6 modules and finding it quite impossible to understand how I should wire everything up to get chais assertions working in my tests.

First I did:

bower install --save-dev chai-qunit

and here I get lost. What should I do next. Do I need to get chai and chai-qunit into qunit’s html file?

<script type="text/javascript" src="/path/to/bower_components/chai/chai.js"></script>
<script type="text/javascript" src="/path/to/bower_components/chai-qunit/dist/main.js"></script>
<script>
     chaiQUnit.globalize();
</script>

or do I need to import in my test file:

import chai-qunit from 'chai-qunit';
chai-qunit.globalize();

#2

Did you resolve this? A am also searching how to integrate chai-qunit into Ember CLI.


#3

ember-mocha is well supported and has feature parity with ember-qunit. There is also a nice ember-cli addon (ember-cli-mocha) that provides mocha + chai flavored blueprints.


#4

Hey @rwjblue, i tried using ember-cli-mocha for a small Ember CLI addon and it turned out to be difficult to set up.

All I want is to use Chai assertions in Ember tests. I don’t want to go through the hassle of switching the whole testing suite.