Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jest unit tests #32

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Jest unit tests #32

wants to merge 4 commits into from

Conversation

tobika
Copy link

@tobika tobika commented May 7, 2017

Hello,
first this PR is not necessarily there to be merged (certainly not in the master branch). It is there to try out if it is possible to use jest as a testrunner for unit tests in ionic.

I started integration unit tests with karma and jasmine which is already a great improvement if we want to test our applications. After having seen the usage of jest in a workshop it seems that there are some really great features that could make testing ionic/angular even more pleasant.

  • Only run tests on modified files
  • Only run tests for modified files since last commit

It would be great to have some feedback from the ionic team about the usage of jest. Feel free to try out the modifications in this PR and give feedback. I am just beginning with unit tests and don't understand much yet but hope ionic becomes a pleasant environment for testing :)

There is one error with jest that I couldn't resolve yet, as soon as we add the NavController to page 1 jest shows this error:
No provider for NavController! at Error (native)

@danielsogl this might interest you aswell

@imrvshah
Copy link

imrvshah commented May 8, 2017

@tobika

It is a very nice compile example. I tried with the same link using Jest-angular-present. I was facing the problem about ionic storage and lodash.js library. I was getting
2017-05-08_1459 Same error If I use lodash.js.

I know that we can fix this with ignoring ng_modules like
00000310

But unfortunately, it didn't work for me.

@datencia
Copy link
Contributor

Hi all, I've got a little repo with an example of testing Ionic2 with Jest. I hope you find it useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants