Nam Pham
Nam Pham

Reputation: 1224

How to setup karma/jasmine to work with ionic2?

Ionic2 was written with typescript and based on angular2. Is it possible to write unit test and e2e test for this? If it's possible, how can we do it?

Sorry for my test framework knowledge, I don't have much experience in karma and jasmine.

Upvotes: 5

Views: 2113

Answers (2)

Hadrien TOMA
Hadrien TOMA

Reputation: 2733

Here is "A ionic 2 (Ionic rc0) boilerplate for starting new projects. This boilerplate will follow the best practices for angular and ionic development."

It gives you all these available NPM scripts commands :

  • dev : run ionic serve
  • build : Full production build. Use flag for dev build.
  • release : generate changelog based on commits
  • push : shortcut for git push origin master --follow-tags
  • lint : lint with tslint
  • scss-lint : lint scss
  • test : runs Karma test
  • e2e : runs e2e protractor tests
  • e2e:interactive : runs e2e protractor tests in interactive mode
  • docs : not working yet
  • outdated : search npm packages for outdated dependencies
  • ios:dev : build .ipa using dev environment vars
  • ios:release : build .ipa with production environment vars
  • android:dev : build .apk using dev environment vars
  • android:release : build .apk with production environment vars

It is in development but I already thank Marco Turi for that!

Upvotes: 1

Wulf Solter
Wulf Solter

Reputation: 714

My colleague has created a simple "Counter" style app with karma/jasmine tests.

Check it out here: https://github.com/lathonez/clicker

Updated to ionic2 (2.0.0-beta.0) and Angular2 (2.0.0-beta.3) - give it a try and open an issue if you need assistance.

Upvotes: 6

Related Questions