Issue
I have created Maven Web application and I generally use
mvn clean install
So it execute npm install
command as its one of the execution goal and then it run karma tests
So my question is, is there any shortcut or command available to skip karma tests conditionally?
Like we have -DskipTests for Maven project to skip tests.
Off course we can simply remove the npm run test
from the package.json
file but I want to skip tests using command.
pom.xml
<build>
<plugins>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>npm install</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<workingDirectory>web/app</workingDirectory>
<installDirectory>build</installDirectory>
<arguments>install
--registry=${npm.registry}
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Solution
Since I am using the frontend-maven-plugin
I had to add below execution to plugin.
<executions>
<execution>
<id>javascript tests</id>
<goals>
<goal>karma</goal>
</goals>
<phase>test</phase>
</execution>
</executions>
After that, just using -DskipTest
build argument able to skip karma tests.
mvn clean install -DskipTests
Answered By - Ganesh Thorat
Answer Checked By - David Goodson (JavaFixing Volunteer)