Skip to content
This repository has been archived by the owner. It is now read-only.
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

ember-cli-chai

npm Build Status

Chai assertions for Ember.js.

Deprecated

This package is deprecated. Please use ember-auto-import to use chai and chai plugins directly. If you'd like to use chai, or were previously using ember-cli-chai, follow these instructions to use chai in your app:

Add ember-auto-import and chai to your project:

ember install ember-auto-import chai

Next, if you are using any plugins, add the following to tests/test-helper.js before calling start from ember-mocha to ensure chai has loaded them:

// tests/test-helper.js
import { start } from 'ember-mocha';
import chai from 'chai';
import chaiDom from 'chai-dom';
chai.use(chaiDom);
start();

Installation

ember install ember-cli-chai

Usage

After installing ember-cli-chai you can import Chai from the chai package:

import chai from 'chai';

or import the expect() function directly:

import { expect } from 'chai';

Have a look at the vendor shim file to understand what else can be imported this way.

QUnit

Previous versions of ember-cli-chai supported QUnit but due to changes in chai itself this is unfortunately no longer viable. For readable DOM assertions in QUnit we recommend qunit-dom instead.

Chai plugins

ember-cli-chai is able to automatically load a number of popular Chai plugins:

All you have to do is install those plugins via npm install --save-dev. Once they are installed and listed as dependencies in your package.json file they will be used automatically.

Using chai-jquery for example will enable you to write JQuery assertions like:

expect(find('.test-element')).to.have.text('hello');

License

ember-cli-chai is licensed under the MIT License.