digitalfondue / jscoverproxy-maven-plugin

a maven plugin for JSCover for a simple use case: generate coverage in conjunction of the jasmine-maven-plugin
Apache License 2.0
1 stars 1 forks source link

jscoverproxy-maven-plugin

Maven Central

A maven plugin for replacing saga-maven-plugin, as it does not generate the correct coverage anymore when used with the jasmine-maven-plugin.

It's powered by JSCover project.

Example of use:

See: http://searls.github.io/jasmine-maven-plugin/code-coverage.html : replace the plugin block for saga-maven-plugin with:

<plugin>
    <groupId>ch.digitalfondue.jscover</groupId>
    <artifactId>jscoverproxy-maven-plugin</artifactId>
    <version>2.0.2.1</version>
    <executions>
        <execution>
            <goals>
                <goal>coverage</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <baseUrl>http://localhost:${jasmine.serverPort}</baseUrl>
        <outputDir>${project.build.directory}/report/</outputDir>
        <noInstruments>
            <noInstrument>webjars/</noInstrument>
            <noInstrument>classpath/</noInstrument>
            <noInstrument>spec/</noInstrument>
        </noInstruments>
        <jsSrcDir>src/main/webapp/app</jsSrcDir><!-- mandatory for LCOV and  COBERTURAXML -->
        <generateXMLSUMMARY>true</generateXMLSUMMARY><!-- optional -->
        <generateLCOV>true</generateLCOV><!-- optional -->
        <generateCOBERTURAXML>true</generateCOBERTURAXML><!-- optional -->
        <timeout>60</timeout> <!-- default 60 seconds -->
        <!-- optionals:
        <includeUnloadedJS>true</includeUnloadedJS>
        <detectCoalesce>true</detectCoalesce>
        <removeJsSnippets>
            <removeJsSnippet>alert('tests');</removeJsSnippet> 
        </removeJsSnippets>
        --><!-- you can remove js code if it cause issues -->
    </configuration>
</plugin>

for additional instrumentation configuration, use instead of "<noInstruments>":

<instrumentPathArgs>
    <arg>--no-instrument=webjars/</arg>
    <arg>--no-instrument=classpath/</arg>
    <arg>--no-instrument=spec/</arg>
</instrumentPathArgs>

you can also use: --no-instrument-reg= and --only-instrument-reg=