0

I have added a dependency to the bower.json and I would like to use it in a angularJs service or controller.

When I use the library inside a web page, everything works correctly because the dependencies are loaded first. This is not the case when I am running unit tests, where dependencies results in an undefined object and my test fails.

How can I import bower-defined dependencies in an angularJs controller for testing purpose?

Edmondo
  • 19,559
  • 13
  • 62
  • 115
  • I'm having same problem with `angular-animate` causing my unit tests to fail. I did `bower install angular-animate --save` too. – Danger14 Apr 08 '14 at 22:15
  • The last time I had a look into it, there was no integration between bower and grunt, which I used for running my tests. How do you run your unit tests? – Edmondo Apr 10 '14 at 13:01
  • I run unit tests using Karma and Jasmine. I believe I solved my issue in my QA. Had to specify which version of `angular-animate` to install. http://stackoverflow.com/questions/22944883/unable-to-find-a-suitable-version-for-angular-with-bower-installation-error-for – Danger14 Apr 10 '14 at 16:59
  • Can you give a more detailed example of what you are trying to do? – jdstein1 Aug 24 '15 at 16:43

1 Answers1

1

I guess that you need to execute:

bower install yourdep --save

Otherwise it won't be saved in the bower.json.

merejy
  • 414
  • 4
  • 17