Search code examples
unit-testingantmavennode.jsnodeunit

Is there a way to run nodeunit tests through maven/ant


I have created some unit tests for my node.js application in nodeunit. I want to be able to run the tests through maven / ant, because I intend to run them through Jenkins. Has anyone had any success doing this?


Solution

  • The Maven exec plugin can be used to run Nodeunit and the appropriate tests.

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <version>1.1.1</version>
        <executions>
          <execution>
            <goals>
              <goal>exec</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <executable>nodeunit</executable>
          <workingDirectory>./</workingDirectory>            
          <arguments>
            <argument>tests/node/ServerTests.js</argument>
          </arguments>          
        </configuration>
      </plugin>