diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5a5f65e04..6fe5c7ab3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,10 @@ Last public release: [)
diff --git a/frontend-maven-plugin/pom.xml b/frontend-maven-plugin/pom.xml
index 97ec4aca1..a8d93098f 100644
--- a/frontend-maven-plugin/pom.xml
+++ b/frontend-maven-plugin/pom.xml
@@ -4,7 +4,7 @@
frontend-plugins
com.github.eirslett
- 1.9.1
+ 1.9.2-SNAPSHOT
frontend-maven-plugin
diff --git a/frontend-maven-plugin/src/main/java/com/github/eirslett/maven/plugins/frontend/mojo/AbstractFrontendMojo.java b/frontend-maven-plugin/src/main/java/com/github/eirslett/maven/plugins/frontend/mojo/AbstractFrontendMojo.java
index 2644835bf..d671cd8d0 100644
--- a/frontend-maven-plugin/src/main/java/com/github/eirslett/maven/plugins/frontend/mojo/AbstractFrontendMojo.java
+++ b/frontend-maven-plugin/src/main/java/com/github/eirslett/maven/plugins/frontend/mojo/AbstractFrontendMojo.java
@@ -1,6 +1,7 @@
package com.github.eirslett.maven.plugins.frontend.mojo;
import java.io.File;
+import java.util.HashMap;
import java.util.Map;
import org.apache.maven.plugin.AbstractMojo;
@@ -17,6 +18,7 @@
public abstract class AbstractFrontendMojo extends AbstractMojo {
+ public static final String INTEGRATION_TEST_FAILED_KEY = "integrationTestFailed";
@Component
protected MojoExecution execution;
@@ -35,6 +37,14 @@ public abstract class AbstractFrontendMojo extends AbstractMojo {
@Parameter(property = "maven.test.failure.ignore", defaultValue = "false")
protected boolean testFailureIgnore;
+ /**
+ * Set this to true to delegate test failures until after 'post-integration' has executed.
+ *
+ * @since 1.9.2
+ */
+ @Parameter(property = "maven.it.failure.after.postIntegration", defaultValue = "false")
+ protected boolean integrationTestFailureAfterPostIntegration;
+
/**
* The base directory for running all Node commands. (Usually the directory that contains package.json)
*/
@@ -71,7 +81,17 @@ private boolean skipTestPhase() {
*/
private boolean isTestingPhase() {
String phase = execution.getLifecyclePhase();
- return "test".equals(phase) || "integration-test".equals(phase);
+ return "test".equals(phase) || isIntegrationTestingPhase();
+ }
+
+ private boolean isIntegrationTestingPhase(){
+ String phase = execution.getLifecyclePhase();
+ return "integration-test".equals(phase);
+ }
+
+ private boolean isVerifyPhase(){
+ String phase = execution.getLifecyclePhase();
+ return "verify".equals(phase);
}
protected abstract void execute(FrontendPluginFactory factory) throws FrontendException;
@@ -83,6 +103,9 @@ private boolean isTestingPhase() {
@Override
public void execute() throws MojoFailureException {
+ if(isVerifyPhase() && integrationTestsHaveFailed()){
+ throw new MojoFailureException("Some integration tests have failed during integration-test phase.");
+ }
if (testFailureIgnore && !isTestingPhase()) {
getLog().info("testFailureIgnore property is ignored in non test phases");
}
@@ -96,6 +119,9 @@ public void execute() throws MojoFailureException {
} catch (TaskRunnerException e) {
if (testFailureIgnore && isTestingPhase()) {
getLog().error("There are test failures.\nFailed to run task: " + e.getMessage(), e);
+ } else if (integrationTestFailureAfterPostIntegration && isIntegrationTestingPhase()) {
+ storeIntegrationTestFailed();
+ getLog().error("There are test failures.\nFailed to run task: " + e.getMessage(), e);
} else {
throw new MojoFailureException("Failed to run task", e);
}
@@ -107,4 +133,20 @@ public void execute() throws MojoFailureException {
}
}
+ private Boolean integrationTestsHaveFailed() {
+ Object failed = getPluginContext().get(INTEGRATION_TEST_FAILED_KEY);
+ return failed != null && (Boolean) failed;
+ }
+
+ private void storeIntegrationTestFailed() {
+ Map pluginContext;
+ if(getPluginContext() != null){
+ pluginContext = getPluginContext();
+ } else {
+ pluginContext = new HashMap<>();
+ }
+ pluginContext.put(INTEGRATION_TEST_FAILED_KEY, true);
+ setPluginContext(pluginContext);
+ }
+
}
diff --git a/frontend-plugin-core/pom.xml b/frontend-plugin-core/pom.xml
index 6794b48f9..fe6213f49 100644
--- a/frontend-plugin-core/pom.xml
+++ b/frontend-plugin-core/pom.xml
@@ -3,7 +3,7 @@
frontend-plugins
com.github.eirslett
- 1.9.1
+ 1.9.2-SNAPSHOT
4.0.0
diff --git a/pom.xml b/pom.xml
index 255c1c54a..4ce8e0afc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
com.github.eirslett
frontend-plugins
- 1.9.1
+ 1.9.2-SNAPSHOT
pom