GithubHelp home page GithubHelp logo

isabella232 / maven-karma-plugin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from karma-runner/maven-karma-plugin

0.0 0.0 0.0 117 KB

Maven plugin for running tests using Karma.

License: Apache License 2.0

Java 100.00%

maven-karma-plugin's Introduction

maven-karma-plugin

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

It has been years since I used this plugin and, quite honestly given the lack of use and activity on it, I'd almost forgot that it even existed. Consequently, I have no wish to continue to maintain the project. If someone wishes to pick up the project I'm more than happy to hand over the reins to someone with more use for it. Alternatively, just fork it.

If you do wish to take it over please get in touch with an org owner

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>
        <karmaExecutable>${basedir}/node_modules/.bin/karma</karmaExecutable>        
        <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>

(In particular, note the use of the karmaExecutable property that implies that the karma executable installed to the local node_modules folder will be used instead of the globally installed version.)

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.

Using a local karma installation

By default, the plugin assumes that karma is installed globally via npm install -g karma. However, if you prefer to use a locally installed karma you can do so by telling the plugin where to find it with the karmaExecutable configuration property; e.g. ${basedir}/node_modules/.bin/karma. (See the full example pom configuration above.)

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.

maven-karma-plugin's People

Contributors

fbengrid avatar joelittlejohn avatar juanluisrp avatar kelveden avatar khirakawa avatar leftiefriele avatar nikku avatar philhardwick avatar sajanchandran avatar worksap-bot avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.