Skip to content

Maven plugin for running tests using Karma.

License

Apache-2.0, Unknown licenses found

Licenses found

Apache-2.0
LICENSE
Unknown
license-header
Notifications You must be signed in to change notification settings

inthegarage/maven-karma-plugin

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

89 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

maven-karma-plugin

Provides the ability to run tests via Karma as part of your Maven build.

Usage

Note that the plugin expects Karma (and nodejs of course) to have been installed beforehand and for the karma executable to be on the system path.

Example of a typical usage:

<plugin>
    <groupId>com.kelveden</groupId>
    <artifactId>maven-karma-plugin</artifactId>
    <version>1.6</version>
    <executions>
        <execution>
            <goals>
                <goal>start</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <browsers>PhantomJS</browsers>
    </configuration>
</plugin>

Full Example:

<plugin>
    <groupId>com.kelveden</groupId>
    <artifactId>maven-karma-plugin</artifactId>
    <version>1.6</version>
    <executions>
        <execution>
            <phase>test</phase>
            <goals>
                <goal>start</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <configFile>src/main/webapp/resources/karma-0.10.2.conf.js</configFile>
        <junitReportFile>src/main/webapp/resources/test-results.xml</junitReportFile>
        <reportsDirectory>${project.build.directory}/karma-reports</reportsDirectory>
        <browsers>PhantomJS</browsers>
        <autoWatch>false</autoWatch>
        <singleRun>true</singleRun>
        <colors>true</colors>
        <skipKarma>false</skipKarma>
        <skipTests>false</skipTests>
        <karmaFailureIgnore>false</karmaFailureIgnore>
        <reporters>dots,junit</reporters>
    </configuration>
</plugin>

More information

Just run:

mvn help:describe -Dplugin=com.kelveden:maven-karma-plugin -Ddetail

The plugin simply shells out to karma; so the properties you specify in the configuration section will be passed on as arguments to Karma itself. See the Karma configuration documentation for more information on the arguments available.

Note that only the subset of karma start arguments that are relevant are supported by the plugin - there's no support for the --port argument, for example.

Note also that if a property isn't specified in the POM it will not be passed to karma start at all - i.e. Karma will pick the default value for the corresponding argument. The exception to this rule is the "singleRun" property which is set to "true" by default as this will be the most common use case in the context of a Maven build.

Releases

Version 1.6

  • "Add support for detecting and exporting 'test-results.xml' for surefire integration", courtesy of @jaymes-bearden. Closes #15.

Version 1.5

Version 1.4

Version 1.3

  • Support for specifying --colors/--no-colors via new "colors" property; courtesy of @fbengrid.

Version 1.2

  • Support for skipTests.

Version 1.1

  • Support for Windows, courtesy of @Nikku. Closes issues #3, #5, #6.
  • New karmaFailureIgnore property that acts in a similar way to the maven-surefire-plugin testFailureIgnore property. Closes issue #4.

Version 1.0

  • Initial release.

Contributing

Bug reports are welcome - pull requests to fix aforementioned bugs even more so! Apart from that, there really isn't much to the plugin and I think it's best to keep it that way. Am open to other thoughts on that though.

About

Maven plugin for running tests using Karma.

Resources

License

Apache-2.0, Unknown licenses found

Licenses found

Apache-2.0
LICENSE
Unknown
license-header

Stars

Watchers

Forks

Packages

No packages published