0

I have an AngularJS module defined in a single HTML file. Unfortunately, I cannot refactor it into separate files.

I need to add unit tests with angular-mocks and jasmine, and I need to run the unit tests with Node.JS (i.e. npm jasmine). I would like to leave karma out of the picture.

I looked at the angular-seed project but all the controllers and views are nicely separated, which is not my case.

How can I reference the AngularJS module in my single HTML files from my spec files?

user11081980
  • 3,059
  • 4
  • 30
  • 48

1 Answers1

0

Unfortunately, unless you roll your own preprocessor to do something like this, it will not be possible.

I also would definitely NOT recommend trying to avoid using Karma to test your angularJS applications, it provides an out of the box solution to test your code in a browser. Otherwise you'll have to do this all on your own and there is really no benefit to that unless you've already done this work.

You can and should separate your JS/HTML files out, it might be work now, but it will create a lot less headaches down the line.

cody mikol
  • 811
  • 7
  • 21