Note that there are some explanatory texts on larger screens.

plurals
  1. POIntegrating Karma JavaScript testing with Maven
    primarykey
    data
    text
    <p>I'm adding Karma-based JS unit tests to Maven. I used the following configuration:</p> <pre><code>&lt;plugin&gt; &lt;groupId&gt;com.kelveden&lt;/groupId&gt; &lt;artifactId&gt;maven-karma-plugin&lt;/artifactId&gt; &lt;version&gt;1.0&lt;/version&gt; &lt;executions&gt; &lt;execution&gt; &lt;goals&gt; &lt;goal&gt;start&lt;/goal&gt; &lt;/goals&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;configuration&gt; &lt;browsers&gt;Chrome&lt;/browsers&gt; &lt;/configuration&gt; &lt;/plugin&gt; </code></pre> <p>Tests work separately (without Maven) on my machine when I use <code>karma start karma.conf.js</code>, but with Maven I got the following error:</p> <pre><code>[ERROR] Failed to execute goal com.kelveden:maven-karma-plugin:1.0:start (default) on project web: There was an error executing Karma. Cannot run program "karma": CreateProcess error=2, The system cannot find the file specified -&gt; [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.kelveden:maven-karma-plugin:1.0:start (default) on project web: There was an error executing Karma. at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217) ... Caused by: java.io.IOException: Cannot run program "karma": CreateProcess error=2, The system cannot find the file specified at java.lang.ProcessBuilder.start(ProcessBuilder.java:460) at com.kelveden.karma.StartMojo.createKarmaProcess(StartMojo.java:151) ... 22 more Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified at java.lang.ProcessImpl.create(Native Method) at java.lang.ProcessImpl.&lt;init&gt;(ProcessImpl.java:81) at java.lang.ProcessImpl.start(ProcessImpl.java:30) at java.lang.ProcessBuilder.start(ProcessBuilder.java:453) ... 23 more </code></pre> <p>Here is why I find it a bit strange: according to <a href="https://github.com/karma-runner/maven-karma-plugin/blob/master/src/main/java/com/kelveden/karma/StartMojo.java" rel="nofollow">this class</a>, the <code>karma.conf.js</code> should be found by default (<code>@Parameter(defaultValue = "${basedir}/karma.conf.js", property = "configFile", required = true)</code>). Also, I tried to pass the path, absolute and relative, in the <code>-DconfigFile=...</code> parameter, it didn't work. I used Windows, but I think it shouldn't be a problem. I'm not sure what exactly can be wrong in the configuration, an advice would be appreciated.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload