Hi I am new to AngularJS and testing JS. I need to run my tests with maven. I have created a controller and a service for a small app and they are working. Now i want to write tests (yes, broke the rule to write tests while developing) for the JS code I have. I have so far managed to invoke the tests with maven.
I am using jasmine-maven-plugin.
<plugin>
<groupId>com.github.searls</groupId>
<artifactId>jasmine-maven-plugin</artifactId>
<version>1.3.1.3</version>
<executions>
<execution>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
<configuration>
<jsSrcDir>src/main/webapp/js</jsSrcDir>
<jsTestSrcDir>src/test/webapp/js</jsTestSrcDir>
<specIncludes>
<include>*Spec.js</include>
</specIncludes>
</configuration>
</plugin>
When run mvn test I see the following
[INFO] --- jasmine-maven-plugin:1.3.1.3:test (default) @ pod-manager-web-ang --- 2013-10-14 14:57:34.322:INFO:oejs.Server:jetty-8.1.13.v20130916 2013-10-14 14:57:34.378:INFO:oejs.AbstractConnector:Started [email protected]:56475 [INFO] Executing Jasmine Specs
Then a failure with the message below
[ERROR] Caused by: net.sourceforge.htmlunit.corejs.javascript.EcmaError: ReferenceError: "angular" is not defined. (http://localhost:56475/src/controllers/controller.js#3)
[ERROR] at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3603)
[ERROR] at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3587)
[ERROR] at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3657)
[ERROR] at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.name(ScriptRuntime.java:1685)
The question is where should I place the angular.js and other angular JS files for these tests to run?