Skip to content

Instantly share code, notes, and snippets.

@willcain
Created March 26, 2012 18:33
Show Gist options
  • Save willcain/2208541 to your computer and use it in GitHub Desktop.
Save willcain/2208541 to your computer and use it in GitHub Desktop.
Maven project snippet for using jasmine-maven-plugin with Surefire and Jenkins
<!--
Thanks and kudos to:
Justin Searls https://github.com/searls for jasmine-maven-plugin,
Pivotal Labs http://pivotallabs.com/ for Jasmine,
Jenkins CI http://jenkins-ci.org for Jenkins,
Apache Software Foundation http://apache.org/ for Maven
-->
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!-- ... -->
<build>
<plugins>
<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>${project.basedir}/src/main</jsSrcDir>
<jsTestSrcDir>${project.basedir}/src/test</jsTestSrcDir>
<!-- need to override default dir for surefire: -->
<junitXmlReportFileName>
../surefire-reports/TEST-jasmine.xml</junitXmlReportFileName>
<sourceIncludes>
<include>**/*.js</include>
</sourceIncludes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12</version>
<executions>
<execution>
<goals>
<goal>test</goal>
</goals>
<!-- ensures surefire runs after jasmine: -->
<phase>package</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
@willcain
Copy link
Author

This Maven (version 2+) project snippet allows you to take Jasmine JavaScript unit test results from the jasmine-maven-plugin, run them through the maven-surefire-plugin, and thus make them available to Jenkins to consume test results in a Jenkins Maven project (not just free-style projects).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment