testing ionic with karma & jasmine..

things to check:

– angular and angular-mocks version (bower line) must match the used version in ionic (look into bundles files?)!

>ionic --version
1.3.22
>npm install karma karma-jasmine karma-phantomjs-launcher jasmine-core --save-dev
>npm install angular-mocks --save-dev
>npm install -g karma-cli
>npm install
>bower install angular-mocks#1.3.13
>karma init karma.conf.js

inside karma.config.js (ORDERING IS RELEVANT!):

 // list of files / patterns to load in the browser
 files: [
 './www/lib/angular/angular.js',
 './www/js/*.js',
 './www/lib/angular-mocks/angular-mocks.js',
 './tests/**/*.js' ],

now run tests with:

>karma start
(or variants like karma start --browsers=Chrome --singleRun=true)

pleaze, do not expect an expert here, better use: http://mcgivery.com/unit-testing-ionic-app/

Advertisements

Published by

man-at-home

totask2 account

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s