Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A Maven Mojo for test execution via NPM script #679

Open
stephenc opened this issue Dec 13, 2017 · 1 comment
Open

A Maven Mojo for test execution via NPM script #679

stephenc opened this issue Dec 13, 2017 · 1 comment

Comments

@stephenc
Copy link
Contributor

Closest duplicate is #235 but that does not describe a complete feature IMHO

Do you want to request a feature or report a bug?

Feature

What is the current behavior?

NPM test execution does not have special handling

If the current behavior is a bug, please provide the steps to reproduce.

What is the expected behavior?

A Maven mojo goal that knows about Maven's test skipping properties and test selection and failure ignoring properties and will also parse the test results (assuming suitably formatted) to apply failure non-ignoring as necessary

Currently, in order to run tests via NPM, you need to do something like: https://github.com/jenkinsci/plugin-pom/blob/03b71039fd98fa63769613109ca9a1d1e3b1b7b3/pom.xml#L1079-L1089

              <execution>
                <phase>test</phase>
                <id>npm mvntest</id>
                <goals>
                  <goal>npm</goal>
                </goals>
                <configuration>
                  <!-- The package.json must define an "mvntest" script -->
                  <arguments>run mvntest</arguments>
                </configuration>
              </execution>

With this feature you would have

              <execution>
                <id>npm mvntest</id>
                <goals>
                  <goal>test-npm</goal>
                </goals>
                <configuration>
                  <!-- The package.json must define an "mvntest" script -->
                  <arguments>run mvntest</arguments>
                </configuration>
              </execution>

The test-npm goal would have a default phase of test (reducing boilerplate configuration) and know about both -DskipTests and -Dmaven.test.failure.ignore=true so that the tests would automatically either be skipped completely or failures would not fail the build.

In addition there would be an option to parse junit style results by specifying a path to junit results

              <execution>
                <id>npm mvntest</id>
                <goals>
                  <goal>test-npm</goal>
                </goals>
                <configuration>
                  <!-- The package.json must define an "mvntest" script -->
                  <arguments>run mvntest</arguments>
                  <junitXmlReports>
                    <junitXmlReport>reports/jest-junit.xml</junitXmlReport>
                    <junitXmlReport>reports/jasmine-junit.xml</junitXmlReport>
                  </junitXmlReports>
                </configuration>
              </execution>

Please mention your frontend-maven-plugin and operating system version.

@antch
Copy link

antch commented May 31, 2019

I'm still looking for a way around this. There isn't really an easy way (that I know of) to run Angular tests through karma directly (it throws an error and bombs), so none of the skip tests properties will actually work. Wouldn't it make sense for these properties to be respected for any goal bound to the "test" or "integration-test" phase, rather than only "karma"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants