Jordan
Jordan

Reputation: 1619

Using Karma to test javascript in a play 2.2.x application

I've got a Play 2 application where my angular js dependencies (and possibly others) are declared using WebJars. When I serve up a page, I use the routing helper to fetch these javascript files.

If I want to test my javascript with Karma I need to specify the path to angular javascript files in order to run my angular dependent code. The examples I've seen on the web don't use web jars and just specify the path as ../app/assets/javascripts/lib/angular.js (or whatever). Is there a better way to do this?

Upvotes: 2

Views: 280

Answers (1)

Dalorzo
Dalorzo

Reputation: 20014

I am not familiar with playframework and therefore I am not entirely understanding the restrictions it is bring to your JS Files but if this helps you can also do something like this in karma.cofig

files: [
    'http://localhost:91/sample.js'
],

I performed some quick tests and it worked fine.

Upvotes: 1

Related Questions