2

I've got a bunch of javascript files I'd like to test, located in src/main/webapp/js, but when I try to build on the command line, I get a bunch of errors due to the missing library files that each of my source scripts depend upon. I am trying to include them within the "sourceIncludes" tag, but this seems to do nothing. I can, however, place them all, one at a time, in the "preloadSources" tags, but I'd rather not do this.

Also, some of my sources files have functions that interact with the DOM, and including the .html file that contains the elements that these functions need just gives me:

"net.sourceforge.htmlunit.corejs.javascript.EcmaError: ReferenceError: "XML" is not defined"

my pom.xml below:

      <plugin>
          <groupId>com.github.searls</groupId>
          <artifactId>jasmine-maven-plugin</artifactId>
          <version>1.1.0</version>
          <executions>
              <execution>
                  <goals>
                      <goal>test</goal>
                  </goals>
              </execution>
          </executions>
          <configuration>
              <jsSrcDir>src/main/webapp/js</jsSrcDir>
              <jsTestSrcDir>src/test/javascript/js</jsTestSrcDir>
              <sourceIncludes>
                  <include>src/main/webapp/js/lib/**/*.js</include>
                  <include>**/*.js</include>
              </sourceIncludes>
              <preloadSources>
                  <preloadSource>src/main/webapp/js/lib/jquery/jquery-1.7.2.js</preloadSource>
              </preloadSources>
          </configuration>
      </plugin>
user1429419
  • 127
  • 3
  • 12

1 Answers1

0

I hate having to list my dependencies in order. That's why I use a dependency loader like Require.js. I wrote a quick post summarizing my experience with jasmine-maven-plugin, but using require.js to load dependencies. It keeps my pom.xml clean, and I let my JavaScript files load their own dependencies. jasmine+maven+requirejs+code coverage

jdobry
  • 1,041
  • 6
  • 17